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

Fix pytest deprecation of pytest.config global. #1404

Merged
merged 1 commit into from Sep 24, 2019

Conversation

whatacold
Copy link
Contributor

@whatacold whatacold commented Aug 22, 2019

Per https://docs.pytest.org/en/latest/deprecations.html#pytest-config-global

pytest.config global
Removed in version 5.0.

The pytest.config global object is deprecated. Instead use request.config (via the request fixture) or if you are a plugin author use the pytest_configure(config) hook. Note that many hooks can also access the config object indirectly, through session.config or item.config for example.

It prevents the WM process to be forked in the subprocess in conftest.py, so I fixed it, and all the tests passed on my side.

Hopefully it won't break the CI.

@flacjacket
Copy link
Member

Have you tried running the tests with the latest pytest version? There are some places we limit that which would be nice to roll back.

@whatacold
Copy link
Contributor Author

whatacold commented Sep 9, 2019

I'm sorry, but I don't think I get the point as my English is not very good.

Do you mean that this will fail with the lastest pytest, or that I should run it with the lastest to ensure nothing is broken?

@pawamoy
Copy link
Contributor

pawamoy commented Sep 9, 2019

I ran it with latest pytest (5.1.2) and everything passes except for the skipped ones and test_svg_scaling, but I don't think it's related to this PR.

    def assert_distortion_less_than(distortion, bad_distortion, factor=0.3):
        for test_val, bad_val in zip(distortion, bad_distortion):
>           assert test_val < (bad_val * factor)
E           assert inf < (22.414 * 0.3)

test/test_images2.py:112: AssertionError

I'm not sure what @flacjacket meant either 😅

@whatacold
Copy link
Contributor Author

whatacold commented Sep 9, 2019

Thanks for running the tests.

And I also encountered this test/test_images2.py:112: AssertionError failure before,
I found that it was because the output of below command was inf :

cmd ['convert', '/tmp/pytest-of-root/pytest-0/audio-volume-muted.png', '/qtile/test/data/comparison_images/audio-volume-muted_good.png', '-metric', 'PSNR', '-compare', '-format', '%[distortion]\n', 'info:']

but I failed to fix it as I'm not familiar with image processing.

Maybe you'd better post it as a seperated issue @pawamoy .

@flacjacket
Copy link
Member

Sorry for the confusion! In c29dfb5 we pinned the pytest version used to be < 5.0.0, if this change allows us to revert that, that'd be great! Also, yes, I think there is other problems with that svg test, that we just don't ever hit on travis....

@whatacold
Copy link
Contributor Author

All test suites except two (they are already reported as issues) are passed with pytest 4.6.5.

In c29dfb5 we pinned the pytest version used to be < 5.0.0

What's the reason for this limit?

@flacjacket
Copy link
Member

All test suites except two (they are already reported as issues) are passed with pytest 4.6.5.

In c29dfb5 we pinned the pytest version used to be < 5.0.0

What's the reason for this limit?

Some of the tests stopped passing, I'd have to go back to check which ones, but limiting the pytest version kept the tests green.

@flacjacket flacjacket merged commit be8f7b4 into qtile:master Sep 24, 2019
@whatacold whatacold deleted the fix-pytest.config-deprecation branch September 25, 2019 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants