Skip to content

Commit

Permalink
Move new provider tests to "provider_tests" submodule (apache#45955)
Browse files Browse the repository at this point in the history
While testing "standard" provider move to the new structure
it turned out, that "providers" package used now to keep tests
in the new providers is problematic - while it solves the
ambiguity of "from celery import", it introduces another
ambiguity when trying to import internal utility classes in tests.
For example when trying to import BasePythonTest in standard
operatori currently we refer to the import from root directory
of Airflow::

```
from providers.tests.standard.operators.test_python
```

However, if we change the package structure to have `providers`
as subpackage of `tests` and trying to import it from `tests`
as root folder to tests, we have:

```
from providers.standard.operators.test_python
```

And it can ambiguously attempt to import

```
from airflow.providers.standard.operators.test_python
```

This confuses IDEs and attempts to run multiple tests
together, because pytest modifies PYTHONPATH while running
tests - and PYTHONPATH modification can be different, depending
on which tests are selected to run.

Changing the sub-package to provider_tests makes it unambiguous
and we can now import:

```
from provider_tests.standard.operators.test_python
```

This is unambiguous and allows to import the tests inside
the provider package, without importing from root of Airlfow
package - making provider package tests "standalone" inside
provider.
  • Loading branch information
potiuk authored Jan 23, 2025
1 parent a1d24cf commit 4dda6ba
Show file tree
Hide file tree
Showing 41 changed files with 0 additions and 0 deletions.
File renamed without changes.

0 comments on commit 4dda6ba

Please sign in to comment.