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

Implement support for pytest 6 #46

Merged
merged 8 commits into from
Jul 27, 2020
Merged

Conversation

bluetech
Copy link
Member

This PR makes the testsuite pass when run against pytest 6 master (will be pytest 6.0.0).

The first two commits fix #45, by @The-Compiler.

Third commit just changes @pytest.mark.tryfirst -> @pytest.hookimpl because it is the modern way to do it (supported since pytest 2.8.0 I think so should be fine).

Fourth commit fixes #31. This is needed anyway, but a pytest commit pytest-dev/pytest@796fba6 made it necessary for the tests here to pass.

Fifth commit changes how the RuntimeWarning is ignored otherwise its out is interleaved with pytest's output which makes the matching fail.

Last commit adds tox -e pytestmaster for easy testing of pytest master. I haven't added it to CI, as it might be unstable, but let me know if this is something you want. Didn't add pytest 6 to CI either, didn't want to add a prerelease.

@@ -13,5 +24,6 @@ def finish():
while atexit_fns:
atexit_fns.pop()()

monkeypatch.setattr(atexit, "register", atexit_fns.append)
monkeypatch.setattr(atexit, "register", lambda func, *args, **kwargs:
atexit_fns.append(AtExitFunc(func, *args, **kwargs)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this be just

Suggested change
atexit_fns.append(AtExitFunc(func, *args, **kwargs)))
atexit_fns.append(functools.partial(func, *args, **kwargs)))

? w/o adding an extra class?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Err, good point, that should work. Didn't think of that!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, but with a slightly different solution.

@@ -53,7 +53,7 @@ def test_xfail(is_crashing, is_strict, testdir):
session_start_title = '*==== test session starts ====*'
loaded_pytest_plugins = 'plugins: forked*'
collected_tests_num = 'collected 1 item'
expected_progress = 'test_xfail.py {expected_letter!s}'.format(**locals())
expected_progress = 'test_xfail.py {expected_letter!s}*'.format(**locals())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please explain why this asterisk is necessary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the [100%] part is properly printed, previously it wasn't because of the missing logstart/logfinish.

@webknjaz
Copy link
Member

@bluetech I'd prefer to have both rc and master mapped to CI. We can always temporarily mark them as allowed to fail if anything starts failing.

@bluetech
Copy link
Member Author

I'd prefer to have both rc and master mapped to CI. We can always temporarily mark them as allowed to fail if anything starts failing.

Added. This adds 10 new CI jobs (actually I noticed I didn't exclude them from Py2.7 - let me fix that - so it's 8 new jobs).

@webknjaz
Copy link
Member

webknjaz commented Jul 27, 2020

@bluetech I don't think dropping py2 is in scope... Oh... you mean avoid running pytest 6 under py2

@bluetech
Copy link
Member Author

Oh... you mean avoid running pytest 6 under py2

Right. Also, since for python2 pytestlatest is equivalent to pytest46 (and there will be no more releases for that), I also excluded that for Python 2.

@webknjaz webknjaz changed the title pytest 6 fixes Implement support for pytest 6 Jul 27, 2020
@webknjaz webknjaz merged commit 1477356 into pytest-dev:master Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants