You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/09/09 20:00:40 UTC

[GitHub] [airflow] andrey-anshin-godel opened a new issue #18125: Create pytest plugin for prepare test environment

andrey-anshin-godel opened a new issue #18125:
URL: https://github.com/apache/airflow/issues/18125


   ### Description
   
   Hi community,
   
   Currently when I've created some kind of test of Dags, Operators and etc. I use approach to configure all variables before import anythings from Apache Airflow (internal plugin) same approach use internally for Apache Airflow (conftest.py) and I think also I lot of people who care about "not deploy until tests passed" do same steps.
   
   I would be nice if we can create plugin for pytest which:
   - Prepare required Environment Variables before run tests by `pytest.ini`, `setup.cfg` or `pyproject.toml`
   - If requires passthroughs already defined Environment Variables
   - Useful fixtures, such as dag_maker, create_task_instance and etc
   
   ### Use case/motivation
   
   Main motivation is plugin for end users which save their time rather than reinventing the wheel
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] Taragolis commented on issue #18125: Create pytest plugin for prepare test environment

Posted by GitBox <gi...@apache.org>.
Taragolis commented on issue #18125:
URL: https://github.com/apache/airflow/issues/18125#issuecomment-916741336


   Most probably my explanation not clear.
   I shouldn't have created it in midnight, I even wasn't  use my main account :-) 
   
   Let me explain wit some sample, probably after that my suggestion become more clear
   
   Fist of all, I've prepared some sample Gist with [simple plugin](https://gist.github.com/Taragolis/766c699f3f9a0065765bfedf5eacc633) for Airflow
   
   Main idea is just plugin which will able to install as regular package by pip - eg `pip install pytest-apache-airflow`
   At that moment internally it work with pytest key  `-p tests.plugins.airflow`
   
   >I think it would be a better idea to prepare a sample repository, which will contain example tests
   
   Yeah, It also nice. Based on to my past experience a lot of teams don't have any idea how even test integrity of dags and just try to deploy (shame, shame, shame)
   
   
   >We currently have documentation that describes how to configure connections and variables in tests. http://airflow.apache.org/docs/apache-airflow/stable/best-practices.html#mocking-variables-and-connections
   
   It also good documentation, and basically this should be used when you need redefine some variables in certain tests, not for global usage.
   
   My suggestion more about Global Environment Variables, which defined in conftest.py:
   https://github.com/apache/airflow/blob/e6cb2f7beb4c6ea4ad4a965f9c0f2b8f6978129c/tests/conftest.py#L32-L35
   
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] mik-laj commented on issue #18125: Create pytest plugin for prepare test environment

Posted by GitBox <gi...@apache.org>.
mik-laj commented on issue #18125:
URL: https://github.com/apache/airflow/issues/18125#issuecomment-916416908


   I think it would be a better idea to prepare a sample repository, which will contain example tests, that everyone can analyze to inspire themselves in their project. I even started working on something similar, but didn't find the time to finish it. https://github.com/mik-laj/airlfow-testing-example  If you are interested, feel free to contribute.
   
   >  configure all variables before import anythings from Apache Airflow
   
   We currently have documentation that describes how to configure connections and variables in tests.  http://airflow.apache.org/docs/apache-airflow/stable/best-practices.html#mocking-variables-and-connections


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] boring-cyborg[bot] commented on issue #18125: Create pytest plugin for prepare test environment

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on issue #18125:
URL: https://github.com/apache/airflow/issues/18125#issuecomment-916395302


   Thanks for opening your first issue here! Be sure to follow the issue template!
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk closed issue #18125: Create pytest plugin for prepare test environment

Posted by GitBox <gi...@apache.org>.
potiuk closed issue #18125:
URL: https://github.com/apache/airflow/issues/18125


   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org