-
Notifications
You must be signed in to change notification settings - Fork 22
Implement support for pytest 6 #46
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
Conversation
testing/conftest.py
Outdated
@@ -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))) |
There was a problem hiding this comment.
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
atexit_fns.append(AtExitFunc(func, *args, **kwargs))) | |
atexit_fns.append(functools.partial(func, *args, **kwargs))) |
? w/o adding an extra class?
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
.
@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. |
Really it is private and shouldn't be imported at all, but that's for another time... Debugged by Florian Bruhin.
Otherwise some reporting is missing. In particular, pytest 6 moves some output to these hooks.
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). |
|
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. |
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.