uranusjr commented on a change in pull request #19867:
URL: https://github.com/apache/airflow/pull/19867#discussion_r758257939



##########
File path: dev/Breeze/requirements.txt
##########
@@ -0,0 +1,4 @@
+click
+pytest
+pytest-xdist
+rich

Review comment:
       Because `python -m` adds the current working directory to `sys.path`, 
while an entry point (which is a script) does not. This is one of the lesser 
known Python quirk; I don’t know what the actual name is but personally call it 
“interpreter mode” (which adds cwd) and “script mode” (which does not).
   
   Pytest actually has specific documentation on this: 
https://docs.pytest.org/en/6.2.x/goodpractices.html#choosing-a-test-layout-import-rules
   
   This is why having a pip-installable package helps; we can lay out 
`dev/breeze` as a Python package:
   
   ```
   airflow/dev/breeze
    |-- pyproject.toml
    |-- setup.py  # assuming we’ll use setuptools...
    |-- src/
    |    `-- breeze/  # Actual Breeze implementation that the PyPI pacakge will 
also use.
    |         `-- __init__.py
    `-- tests/
         |-- conftest.py
         `-- test_breeze.py
   ```
   
   And `pip install -e ./dev/breeze` + `pytest dev/breeze/tests` would work 
automatically.




-- 
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