1 From acf7c4e073030a69712172b133076101e2b7d81f Mon Sep 17 00:00:00 2001
2 From: Tomas Orsava <torsava@redhat.com>
3 Date: Mon, 12 Dec 2016 12:09:47 +0100
4 Subject: [PATCH] Patch for compatibility with Python 3.6
6 Python 3.6 returns a ModuleNotFoundError instead of the previous ImportError.
8 functional_tests/test_loader.py | 2 +-
9 functional_tests/test_withid_failures.rst | 12 ++++++------
10 2 files changed, 7 insertions(+), 7 deletions(-)
12 diff --git a/functional_tests/test_loader.py b/functional_tests/test_loader.py
13 index 81aaa7b..3f82122 100644
14 --- a/functional_tests/test_loader.py
15 +++ b/functional_tests/test_loader.py
16 @@ -369,7 +369,7 @@ class TestNoseTestLoader(unittest.TestCase):
17 assert res.errors, "Expected errors but got none"
18 assert not res.failures, res.failures
19 err = res.errors[0][0].test.exc_class
20 - assert err is ImportError, \
21 + assert issubclass(err, ImportError), \
22 "Expected import error, got %s" % err
24 def test_load_nonsense_name(self):
25 diff --git a/functional_tests/test_withid_failures.rst b/functional_tests/test_withid_failures.rst
26 index cf09d4f..cb20886 100644
27 --- a/functional_tests/test_withid_failures.rst
28 +++ b/functional_tests/test_withid_failures.rst
30 >>> support = os.path.join(os.path.dirname(__file__), 'support', 'id_fails')
31 >>> argv = [__file__, '-v', '--with-id', '--id-file', idfile, support]
32 >>> run(argv=argv, plugins=[TestId()]) # doctest: +ELLIPSIS
33 - #1 Failure: ImportError (No module ...apackagethatdoesntexist...) ... ERROR
34 + #1 Failure: ... (No module ...apackagethatdoesntexist...) ... ERROR
36 #3 test_b.test_fail ... FAIL
38 ======================================================================
39 - ERROR: Failure: ImportError (No module ...apackagethatdoesntexist...)
40 + ERROR: Failure: ... (No module ...apackagethatdoesntexist...)
41 ----------------------------------------------------------------------
42 Traceback (most recent call last):
44 - ImportError: No module ...apackagethatdoesntexist...
45 + ...: No module ...apackagethatdoesntexist...
47 ======================================================================
48 FAIL: test_b.test_fail
49 @@ -35,14 +35,14 @@ Addressing failures works (sometimes).
51 >>> _junk = sys.modules.pop('test_a', None) # 2.3 requires
52 >>> run(argv=argv, plugins=[TestId()]) #doctest: +ELLIPSIS
53 - #1 Failure: ImportError (No module ...apackagethatdoesntexist...) ... ERROR
54 + #1 Failure: ... (No module ...apackagethatdoesntexist...) ... ERROR
56 ======================================================================
57 - ERROR: Failure: ImportError (No module ...apackagethatdoesntexist...)
58 + ERROR: Failure: ... (No module ...apackagethatdoesntexist...)
59 ----------------------------------------------------------------------
60 Traceback (most recent call last):
62 - ImportError: No module ...apackagethatdoesntexist...
63 + ...: No module ...apackagethatdoesntexist...
65 ----------------------------------------------------------------------