-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
pytest tests explicitly check for ImportError, fails on Python 3.6 #2132
Comments
This fixes the thing (except the zope part), but makes the tests less specific, so I'm unsure, if it is a right approach. diff --git a/testing/test_doctest.py b/testing/test_doctest.py
index 4ea2cc5..a82071c 100644
--- a/testing/test_doctest.py
+++ b/testing/test_doctest.py
@@ -211,8 +211,8 @@ class TestDoctests:
# doctest is never executed because of error during hello.py collection
result.stdout.fnmatch_lines([
"*>>> import asdals*",
- "*UNEXPECTED*ImportError*",
- "ImportError: No module named *asdal*",
+ "*UNEXPECTED*Error*",
+ "*Error: No module named *asdal*",
])
def test_doctest_unex_importerror_with_module(self, testdir):
@@ -227,7 +227,7 @@ class TestDoctests:
# doctest is never executed because of error during hello.py collection
result.stdout.fnmatch_lines([
"*ERROR collecting hello.py*",
- "*ImportError: No module named *asdals*",
+ "*Error: No module named *asdals*",
"*Interrupted: 1 errors during collection*",
]) I was also able to do pip freeze:
|
Thanks for reporting this! This reminds me that we should start testing pytest automatically on Python 3.6 as well, created an issue to track this: #2134. Your patch looks fine to me FWIW. |
hroncok
added a commit
to hroncok/pytest
that referenced
this issue
Dec 13, 2016
This tests originally checked for ImportError. Since Python 3.6 ModuleNotFoundError is raised in this context instead, the test didn't work as it is text based (so exception inheritance does not save the day). The test now simply checks for any *Error, which makes it less specific, but still valuable. Fixes pytest-dev#2132
hroncok
added a commit
to hroncok/pytest
that referenced
this issue
Dec 27, 2016
Those tests originally checked for ImportError. Since Python 3.6 ModuleNotFoundError is raised in this context instead, the tests didn't work as they are text based (so exception inheritance does not save the day). Fixes pytest-dev#2132
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to run the test suite on Python 3.6.
Here https://github.com/pytest-dev/pytest/blob/3.0.5/testing/test_doctest.py#L215 the tests try to check if the text
ImportError
is in the output, but on Python 3.6, I'm gettingModuleNotFoundError
instead, which I think is OK and the test should work withModuleNotFoundError
as well.Note that the other issue with zope interaces is weird as well because I'm confident I have those, but I will explore that later. Might be related to #1989
Unfortunately from this environment, I cannot call pip freeze. It's Fedora rawhide (26) and Python 3.6.0rc1.
The text was updated successfully, but these errors were encountered: