Dear pytest enthusiasts,


This is not pytest per se but quite low-level python so you may find it 
interesting also for pytest, that has many decorators.



--

Writing python decorators is quite a tideous process, in particular when you 
wish to add arguments, and in particular in two cases : all optional arguments, 
and one mandatory argument. Indeed in these two cases there is a need to 
disambiguate between no-parenthesis and with-parenthesis usage.



After having struggled with this pattern for two years in various open source 
and industrial projects, I ended up writing a library to hopefully solve this 
once and for all: https://smarie.github.io/python-decopatch/ . It is 
extensively tested (203 tests) against many combinations of signature/calls.

I would gladly appreciate any feedback !



Please note that there is a "PEP proposal draft" in the project page because I 
belive that the best a library can do will always be a poor workaround, where 
the interpreter or stdlib could really fix it properly.

Sorry for not providing too much implementation details in that page, my 
knowledge of the python interpreter is unfortunately quite limited.



--



Finally there is an additional topic around decorators : people tend to believe 
that decorators and function wrappers are the same, which is absolutely not the 
case. I used the famous `decorator` lib in many projects but I was not 
satisfied because it was solving both issues at the same time, maintaining the 
confusion. I therefore proposed https://smarie.github.io/python-makefun/ . In 
particular it provides an equivalent of `@functools.wraps` that is truly 
signature-preserving (based on the same recipe than `decorator`).

Once again, any feedback would be gladly appreciated !



Kind regards



--

Sylvain

De : pytest-dev <pytest-dev-bounces+sylvain.marie=se....@python.org> De la part 
de Guilherme Zagatti
Envoyé : vendredi 8 mars 2019 17:42
À : pytest-dev@python.org
Objet : [pytest-dev] pytest-airflow plugin


[External email: Use caution with links and attachments]

________________________________


Dear Pytest Development Community,

My name is Guilherme Zagatti. I am a developer at Flowminder, an award winning 
social-enterprise especializing in the use of Big Data for international 
development.

We are big fans of pytest. We needed to integrate pytest with Airflow to 
develop data quality assurance tests before ingesting data to our databases. 
Therefore we created the pytest-airflow pluging.

We just made it available to 
pypi<https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpypi.org%2Fproject%2Fpytest-airflow%2F&data=02%7C01%7Csylvain.marie%40se.com%7Cfe6fbcfd886b4c44b51a08d6a3e4fe28%7C6e51e1adc54b4b39b5980ffe9ae68fef%7C0%7C0%7C636876601242673699&sdata=G9pCyCC7qSINOZsAJT5DDQJ66D4l8kdBAEOYIUhOIRs%3D&reserved=0>
 and open sourced in 
Github<https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FFlowminder%2Fpytest-airflow&data=02%7C01%7Csylvain.marie%40se.com%7Cfe6fbcfd886b4c44b51a08d6a3e4fe28%7C6e51e1adc54b4b39b5980ffe9ae68fef%7C0%7C0%7C636876601242673699&sdata=%2FbgPf3din6OYcW18Q5kN8YkVxkywVrueOl%2B7a6uJO%2Fw%3D&reserved=0>.
 It would be great to receive feedback from the pytest community and your 
suggestions on how to best promote the plugin to other users.

I am available to provide further details on the plugin. In the meanwhile, I 
have made available an architecture 
documentation<https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FFlowminder%2Fpytest-airflow%2Fblob%2Fmaster%2Fdocs%2Farchitecture.md&data=02%7C01%7Csylvain.marie%40se.com%7Cfe6fbcfd886b4c44b51a08d6a3e4fe28%7C6e51e1adc54b4b39b5980ffe9ae68fef%7C0%7C0%7C636876601242683709&sdata=mEM3cR9zidi7HAspIylQP2XRsrF%2B9jvnhonMpql4rWA%3D&reserved=0>
 that contains a primer on pytest and detailed explanation of the plugin. 
Perhaps the contents of this document is of interest to the pytest community 
more generally. Feel free to provide comments and share more widely.

Again, very-well done for maintaining pytest.

Best,

Guilherme Zagatti

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
______________________________________________________________________
_______________________________________________
pytest-dev mailing list
pytest-dev@python.org
https://mail.python.org/mailman/listinfo/pytest-dev

Reply via email to