Uh oh!
There was an error while loading. Please reload this page.
Update pinned pytest version to 6.2.1 and fix error in test_exceptions.py::test_python_alreadyset_in_destructor - #2741
Conversation
henryiii
commented
Dec 23, 2020
I think we just need to add a marker to turn this extra pytest feature off for this test. We do want this behavior. I noticed the dropping of 3.5 in the changelog. |
It would be nice if we could explicitly turn it off for just that test, though, and not for everything, with the blunt
|
bstaletic
commented
Dec 23, 2020
Can we use the |
…k__ instead of sys.unraisablehook
YannickJadoul
commented
Dec 23, 2020
Got something. The original built-in |
Why make it a string but still error out if unfound, PyTest... needs an if to see if that exception exists. |
| "ignore::pytest.PytestUnraisableExceptionWarning" | ||
| ) | ||
| else: | ||
| ignore_pytest_unraisable_warning = lambda f: f # NOQA: E731 |
There was a problem hiding this comment.
Yes, I could not put a lambda, and put 2 lines def ignore_pytest_unraisable_warning(f): and return f, but then black suddenly adds an empty line after else:, so that's just as ugly.
YannickJadoul
commented
Dec 24, 2020
Yeah, indeed ... :-/ Guess they're just following the |
| assert d["good"] is True | ||
| if hasattr(pytest, "PytestUnraisableExceptionWarning"): # Python >= 3.8 and pytest >= 6 |
There was a problem hiding this comment.
Alternatively, we move this into the function, and directly use the warnings module. But I'm not sure whether such a filter would get reset after the test or not, this way.
YannickJadoul
commented
Dec 24, 2020
Green! :-) Ready to be reviewed. |
bstaletic
left a comment
There was a problem hiding this comment.
Like I said "a decorator factory" could be a fancy way of avoiding code in global scope, but not a blocker.
Uh oh!
There was an error while loading. Please reload this page.
| hooked = True | ||
| default_hook = sys.unraisablehook | ||
| # Don't take `sys.unraisablehook`, as that's overwritten by pytest | ||
| default_hook = sys.__unraisablehook__ |
There was a problem hiding this comment.
I take it we're happy with this?
If some case where this would be overwritten (by something else than pytest), we're ignoring it as well, ofc, but ... myeah, best I could immediately think of.
There was a problem hiding this comment.
Yes, it seems fine to me. We don't want pytest's version here, and it's a test, so nothing else should be fiddling with it.
YannickJadoul
commented
Dec 24, 2020
Does this need to be marked 2.6.2, still? I guess it's kind of independent from the releases, but ... Guess it's mostly #2573 that needs to make sure it also installs |
henryiii
commented
Dec 24, 2020
Great! We don't really control the PyTest version if someone wants to run our tests (a requirements.txt is an internal pinning, not an external one), and a few of our tests use system PyTests, but it's good not to be (too) version specific, tests failing due to PyTest is not ideal. |
YannickJadoul
commented
Dec 24, 2020
Do you want a changelog for this, @henryiii? |
henryiii
commented
Dec 24, 2020
Yes, I added it to the description. Here it is in setuptools changelog, for example: https://setuptools.readthedocs.io/en/latest/history.html#misc |
YannickJadoul
commented
Dec 24, 2020
Great! Hadn't spotted that; thanks! :-) |
Description
As noted in #2573 (comment), pytest 6 seems to make one of our tests fail. Let's check this, and then figure out if/how to fix that.
Suggested changelog entry: