apache / apache/airflow

Add missing tests for the `apache.hive` macros plugin

Open
#72,267 3 comments 0 reactions 1 assignee Claimed by @wtwyford View on GitHub
area:providers contributors-workshop
Dominant language
Python
Stars
46.9k
Forks
17.8k
Avg merge
2d 9h
Merged PRs (30d)
472

Description

## Description

> This is an issue that is reserved for the Airflow Summit "Contributors" Workshop. This is denoted with the label `contributors-workshop`. Out of respect for the organizers and participants of this workshop, **please do not implement a PR that addresses this issue.**
>
> If this issue is still open following Airflow Summit, the label will be removed and the issue can be picked up.

One module in the `apache.hive` provider has no dedicated test module, and (unlike most entries on the `OVERLOOKED_TESTS` list) it is not covered indirectly. Nothing under any `providers/*/tests/` directory imports it at all:

| Module | Expected test file |
| --- | --- |
| `providers/apache/hive/src/airflow/providers/apache/hive/plugins/hive.py` | `providers/apache/hive/tests/unit/apache/hive/plugins/test_hive.py` |

It is currently suppressed in the `OVERLOOKED_TESTS` allowlist in [`airflow-core/tests/unit/always/test_project_structure.py`](https://github.com/apache/airflow/blob/main/airflow-core/tests/unit/always/test_project_structure.py).

This is a scoped subset of the meta issue #35442, limited to the `apache.hive` provider.

### What should these tests cover?

`HivePlugin` is the registration point that delivers the `max_partition` and `closest_ds_partition` macros to Dag authors. The macros themselves are already covered in `providers/apache/hive/tests/unit/apache/hive/macros/test_hive.py`, but nothing asserts that they are actually exposed through the plugin, so a rename or a dropped entry in the `macros` list would ship without failing anything and would only surface as an undefined name in a user template.

The module is 28 lines and the test should stay proportionate to that. Worth asserting:

- `HivePlugin.name` is `hive`
- `HivePlugin.macros` contains both `max_partition` and `closest_ds_partition`
- `HivePlugin` is a subclass of `AirflowPlugin`
- the dotted path declared as `plugin-class` in `providers/apache/hive/provider.yaml`, which is `airflow.providers.apache.hive.plugins.hive.HivePlugin`, resolves to that class

That last point is the one with real value, because it is the link between the packaging metadata and the code, and it is currently unverified in both directions.

## Definition of Done

1. Add the test module at the path in the table above.
2. Remove the corresponding entry from `OVERLOOKED_TESTS` in `airflow-core/tests/unit/always/test_project_structure.py`
3. This test should pass:

```bash
breeze testing providers-tests providers/apache/hive/tests/unit/apache/hive/plugins/test_hive.py
```

---
Drafted-by: Claude Code (Opus 5); reviewed and edited by @jroachgolf84 before posting.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.