potiuk commented on PR #43280:
URL: https://github.com/apache/airflow/pull/43280#issuecomment-2448622281

   @ashb @vincbeck 
   
   I was really scratching my head why this happen and could not figure it out, 
but I know what happens. I recalled some of the history, I checked out the 
version before the providers move and it turned out that the "tests" folder has 
been added there even then.
   
   BUT (And here comes surprise from pytest) the "tests" were never collected 
when we added any provider's tests because of af a bug introduced in Pytest 8: 
https://github.com/pytest-dev/pytest/issues/12605#issuecomment-2291198620
   
   The thing that if you run: `pytest tests tests/providers/something` - the 
"tests" pytest will NOT be collected, because as of Pytest 8, if there is a 
parent folder before sub-path, ONLY  the subpath tests are collected (!!!!).
   
   It's a very weird pytest behaviour that had already bitten us and I had to 
workaround it in `run_tests.py` for parallell non-db tests:
   
https://github.com/apache/airflow/blob/51f9e835bf4e40e418f9f45a510a639068b08fa2/dev/breeze/src/airflow_breeze/utils/run_tests.py#L401
   
   So The "tests" folder had been there for quite some time (after we switched 
to Pytest 8) - but we never  realized it, because system test providers were 
subfolder of the "tests" and when you run `pytest  tests 
tests/providers/amazon/sytem/some_test.py` - pytest did not collect all the 
tests from "tests" folder - only used the some_test.py folder.
   
   This is now `pytest  tests providers/amazon/tests/sytem/some_test.py` - and 
in this case both "tests" and the system test are collected.
   
   Weird as it is, but simply "tests" should have not been at all in this case, 
but it was never a problem, because all the tests were in "tests/" sub-folder 
and simply the first "tests" folder was ignored.
   
   So now when I **know** how we get it, the fix will be easy. PR shortly.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to