Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collect sawarning as error in pytest #28590

Closed
wants to merge 1 commit into from
Closed

Conversation

BobDu
Copy link
Contributor

@BobDu BobDu commented Dec 26, 2022

Signed-off-by: BobDu i@bobdu.cc

related: #28198 #28544

Improve unit test make sure there isn't a regression in the future.

when delete

.join(DM, TI.dag_id == DM.dag_id)

run pytest tests/jobs/test_scheduler_job.py::TestSchedulerJob::test_find_zombies
while have a error in unit test result

FAILED tests/jobs/test_scheduler_job.py::TestSchedulerJob::test_find_zombies - sqlalchemy.exc.SAWarning: SELECT statement has a cartesian product between FROM element(s) "dag" and FROM element "task_instance".  Apply join condition(s) between each element to...

ref: https://docs.python.org/3/library/warnings.html#the-warnings-filter


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
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.

Signed-off-by: BobDu <i@bobdu.cc>
@Taragolis
Copy link
Contributor

@BobDu I think this changes conflicts with pytest-capture-warnings plugin. I check locally and with our current settings and plugins nothing happen, unfortunetly

Without disable pytest-capture-warnings

root@a33668319fad:/opt/airflow# pytest tests/jobs/test_scheduler_job.py::TestSchedulerJob

==================================================================== test session starts ====================================================================
platform linux -- Python 3.7.16, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 -- /usr/local/bin/python
cachedir: .pytest_cache
rootdir: /opt/airflow, configfile: pytest.ini
plugins: cov-4.0.0, asyncio-0.20.3, rerunfailures-9.1.1, instafail-0.4.2, anyio-3.6.2, timeouts-1.2.1, xdist-3.1.0, requests-mock-1.10.0, capture-warnings-0.0.4, httpx-0.21.2, time-machine-2.8.2
asyncio: mode=strict
setup timeout: 0.0s, execution timeout: 0.0s, teardown timeout: 0.0s
collected 142 items    

...

All Warning errors can be found in the warnings.txt file.

...

============================================================== 139 passed, 3 skipped in 17.45s ==============================================================

Disable pytest-capture-warnings

root@a33668319fad:/opt/airflow# pytest -p no:capture_warnings tests/jobs/test_scheduler_job.py::TestSchedulerJob

==================================================================== test session starts ====================================================================
platform linux -- Python 3.7.16, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 -- /usr/local/bin/python
cachedir: .pytest_cache
rootdir: /opt/airflow, configfile: pytest.ini
plugins: cov-4.0.0, asyncio-0.20.3, rerunfailures-9.1.1, instafail-0.4.2, anyio-3.6.2, timeouts-1.2.1, xdist-3.1.0, requests-mock-1.10.0, httpx-0.21.2, time-machine-2.8.2
asyncio: mode=strict
setup timeout: 0.0s, execution timeout: 0.0s, teardown timeout: 0.0s
collected 142 items     

...

================================================================== short test summary info ==================================================================
...
FAILED tests/jobs/test_scheduler_job.py::TestSchedulerJob::test_find_zombies_nothing - sqlalchemy.exc.SAWarning: SELECT statement has a cartesian product ...
FAILED tests/jobs/test_scheduler_job.py::TestSchedulerJob::test_find_zombies - sqlalchemy.exc.SAWarning: SELECT statement has a cartesian product between ...
FAILED tests/jobs/test_scheduler_job.py::TestSchedulerJob::test_find_zombies_handle_failure_callbacks_are_correctly_passed_to_dag_processor - sqlalchemy.e...
================================================== 3 failed, 136 passed, 3 skipped, 26 warnings in 18.43s ===================================================

@BobDu
Copy link
Contributor Author

BobDu commented Dec 30, 2022

@BobDu I think this changes conflicts with pytest-capture-warnings plugin. I check locally and with our current settings and plugins nothing happen, unfortunetly

covert to draft and i will explore this.

@BobDu BobDu marked this pull request as draft December 30, 2022 02:52
@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Feb 14, 2023
@Taragolis Taragolis removed the stale Stale PRs per the .github/workflows/stale.yml policy file label Feb 18, 2023
@github-actions
Copy link

github-actions bot commented Apr 5, 2023

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Apr 5, 2023
@github-actions github-actions bot closed this Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Stale PRs per the .github/workflows/stale.yml policy file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants