-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
Upgrade pytest to v8 #37151
Upgrade pytest to v8 #37151
Conversation
depends on: pytest-dev/pytest-asyncio#765 |
It will be fixed in the next release |
Hey @hussein-awala -> the big problem is pytest-httpx. The latest version we can install in Python 3.8 is 0.23.1 (0.24 and above is Python >= 3.9. The 0.23.1 has Pytest < 8 so |
There is a exactly 1(!) test that uses test_info_command.py: def test_show_info_anonymize_fileio(self, httpx_mock, setup_parser): |
PR removing pytest-httpx here: #37334 - once we merge it , we can try again. |
For the future @hussein-awala - One easy way to test if a new dependency is not conflicting is quite simple:
This should find if there is any conflict, much quicker (because you specifically choose dependency version and In this case the message was:
This is how I found out pytest-httpx is problematic. |
Thanks Jarek for this detailed explanation and for the tip to test the future changes. |
I'm still trying to understand why Changing the logging level and moving the logger to a fixture did not resolve the issue. I need to thoroughly check the pytest changelog to understand what's going on. |
@hussein-awala : change patching: |
yes, I tried that too, but it didn't work. |
This one is strange :) |
Try to add format which include
Something like that h.setFormatter(CustomTTYColoredFormatter(fmt="%(asctime)s: %(log_color)s%(message)s%(reset)s")) |
It seems to work with this, which is more strange to me 🤔 Let's wait for the CI |
Ah - interesting, that would mean that the default logging configuration is not initialized the first time you enter them (because airflow configuration is not writen to airflow.cfg yet. |
Or smth equally racy |
One of the possible reason changes in collection order: pytest-dev/pytest#7777 Other changes in pytest 8: https://docs.pytest.org/en/stable/changelog.html |
Nice and looks green :) |
TOO QUICK :) |
Seems like, configs from providers do not loaded for this tests. |
Worthwhile to try it again with 8.1.1, it might fix some issues. |
Looks promising only couple of tests:
|
Getting closer :) |
I could reproduce FAB tests failure in pytest 7 if I run this module in random order root@d9cbab8b3875:/opt/airflow# pip install pytest-random-order
root@d9cbab8b3875:/opt/airflow# pytest tests/providers/fab/auth_manager/test_security.py --random-order
...
======================================================================= 3 failed, 56 passed, 20 warnings in 7.76s =======================================================================
root@d9cbab8b3875:/opt/airflow# pytest tests/providers/fab/auth_manager/test_security.py --random-order
======================================================================= 7 failed, 52 passed, 20 warnings in 7.91s =======================================================================
root@d9cbab8b3875:/opt/airflow# pytest tests/providers/fab/auth_manager/test_security.py
...
============================================================================ 59 passed, 20 warnings in 7.81s ============================================================================ 100% there is some side effect which make tests work in this case, in pytest 8 the order slightly different so that is why the error happen into the CI |
789c99a could fix it while keeping the test logic correct |
I also fixed it by changing the fixtures scope from |
I've tried to do the same things locally, but still have a side effects in random order @pytest.fixture(autouse=True)
def clear_db_after_suite(app):
clear_db_runs()
clear_db_dags()
delete_users(app)
delete_roles(app)
yield
delete_users(app)
delete_roles(app)
clear_db_runs()
clear_db_dags() for example this two test in that order effect to each other pytest "tests/providers/fab/auth_manager/test_security.py::TestHasAccessDagDecorator::test_dag_id_consistency[a-None-None-a-False]" tests/providers/fab/auth_manager/test_security.py::test_permissions_work_for_dags_with_dot_in_dagname |
But yeah if fix help we just need to create a task for a properly fix this test module |
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. |
No description provided.