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 2022/12/06 12:36:50 UTC
[GitHub] [airflow] ashb opened a new pull request, #28153: Ensure that warnings from `@dag` decorator are reported in dag file
ashb opened a new pull request, #28153:
URL: https://github.com/apache/airflow/pull/28153
It's no use to a user if the warnings appear from
`airflow/models/dag.py`!
This hacky magic has been in place for the apply_defaults metaclass for
a couple of releases, and for all it's evil hackiness, it works, I've
just extracted it out to be reusable.
Also I wish Python had something like this built in, as it's _really_
hard to get this right otherwise
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of an existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
--
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] ashb commented on pull request #28153: Ensure that warnings from `@dag` decorator are reported in dag file
Posted by GitBox <gi...@apache.org>.
ashb commented on PR #28153:
URL: https://github.com/apache/airflow/pull/28153#issuecomment-1339451784
Curious, this passes locally: `pytest --tb=short -k warning_location tests/models/test_dag.py`
I wonder why when it's run with other tasks it doesn't give a warning at all.
--
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] ashb merged pull request #28153: Ensure that warnings from `@dag` decorator are reported in dag file
Posted by GitBox <gi...@apache.org>.
ashb merged PR #28153:
URL: https://github.com/apache/airflow/pull/28153
--
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] ashb commented on pull request #28153: Ensure that warnings from `@dag` decorator are reported in dag file
Posted by GitBox <gi...@apache.org>.
ashb commented on PR #28153:
URL: https://github.com/apache/airflow/pull/28153#issuecomment-1339602083
@potiuk Oh. The warnings plugin you added seems to clash with Pytest-s `recwarning` fixture :(
--
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 commented on pull request #28153: Ensure that warnings from `@dag` decorator are reported in dag file
Posted by GitBox <gi...@apache.org>.
potiuk commented on PR #28153:
URL: https://github.com/apache/airflow/pull/28153#issuecomment-1339713661
> @potiuk Oh. The warnings plugin you added seems to clash with Pytest-s `recwarn` fixture :(
>
> `pytest.warns` still works, so I guess this is just a FYI for us.
@ashb - It's not the plugin, but the `--disable-warnings` flag that I added to get rid of the duplicated warning output.
Actually, I even added an entry about to "writing unit tests" chapter in TESTING.rst when I added the plugin:
https://github.com/apache/airflow/blob/main/TESTING.rst#writing-unit-tests
> Use pytest.warn to capture warnings rather than recwarn fixture. We are aiming for 0-warning in our tests, so we run Pytest with --disable-warnings but instead we have pytest-capture-warnings plugin that overrides recwarn fixture behaviour.
--
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] ashb commented on pull request #28153: Ensure that warnings from `@dag` decorator are reported in dag file
Posted by GitBox <gi...@apache.org>.
ashb commented on PR #28153:
URL: https://github.com/apache/airflow/pull/28153#issuecomment-1339754189
> > `pytest.warns` still works, so I guess this is just a FYI for us.
>
> @ashb - I believe tt's not the plugin, but the `--disable-warnings` flag that I added to get rid of the duplicated warning output.
> Actually, I even added an entry about to "writing unit tests" chapter in TESTING.rst when I added the plugin
Nope, I tried that when attempting to reproduce locally (I copied the command line from ci output) and it wasn't until I rebuilt my image and added in the `--output` flag that it started failing locally too
--
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 commented on pull request #28153: Ensure that warnings from `@dag` decorator are reported in dag file
Posted by GitBox <gi...@apache.org>.
potiuk commented on PR #28153:
URL: https://github.com/apache/airflow/pull/28153#issuecomment-1339764722
Ah ok. That narrows it down :)
--
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 commented on pull request #28153: Ensure that warnings from `@dag` decorator are reported in dag file
Posted by GitBox <gi...@apache.org>.
potiuk commented on PR #28153:
URL: https://github.com/apache/airflow/pull/28153#issuecomment-1339706168
Nice!
--
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