0504c5
From acf7c4e073030a69712172b133076101e2b7d81f Mon Sep 17 00:00:00 2001
0504c5
From: Tomas Orsava <torsava@redhat.com>
0504c5
Date: Mon, 12 Dec 2016 12:09:47 +0100
0504c5
Subject: [PATCH] Patch for compatibility with Python 3.6
0504c5
0504c5
Python 3.6 returns a ModuleNotFoundError instead of the previous ImportError.
0504c5
---
0504c5
 functional_tests/test_loader.py           |  2 +-
0504c5
 functional_tests/test_withid_failures.rst | 12 ++++++------
0504c5
 2 files changed, 7 insertions(+), 7 deletions(-)
0504c5
0504c5
diff --git a/functional_tests/test_loader.py b/functional_tests/test_loader.py
0504c5
index 81aaa7b..3f82122 100644
0504c5
--- a/functional_tests/test_loader.py
0504c5
+++ b/functional_tests/test_loader.py
0504c5
@@ -369,7 +369,7 @@ class TestNoseTestLoader(unittest.TestCase):
0504c5
         assert res.errors, "Expected errors but got none"
0504c5
         assert not res.failures, res.failures
0504c5
         err = res.errors[0][0].test.exc_class
0504c5
-        assert err is ImportError, \
0504c5
+        assert issubclass(err, ImportError), \
0504c5
             "Expected import error, got %s" % err
0504c5
 
0504c5
     def test_load_nonsense_name(self):
0504c5
diff --git a/functional_tests/test_withid_failures.rst b/functional_tests/test_withid_failures.rst
0504c5
index cf09d4f..cb20886 100644
0504c5
--- a/functional_tests/test_withid_failures.rst
0504c5
+++ b/functional_tests/test_withid_failures.rst
0504c5
@@ -7,16 +7,16 @@
0504c5
     >>> support = os.path.join(os.path.dirname(__file__), 'support', 'id_fails')
0504c5
     >>> argv = [__file__, '-v', '--with-id', '--id-file', idfile, support]
0504c5
     >>> run(argv=argv, plugins=[TestId()]) # doctest: +ELLIPSIS
0504c5
-    #1 Failure: ImportError (No module ...apackagethatdoesntexist...) ... ERROR
0504c5
+    #1 Failure: ... (No module ...apackagethatdoesntexist...) ... ERROR
0504c5
     #2 test_b.test ... ok
0504c5
     #3 test_b.test_fail ... FAIL
0504c5
     <BLANKLINE>
0504c5
     ======================================================================
0504c5
-    ERROR: Failure: ImportError (No module ...apackagethatdoesntexist...)
0504c5
+    ERROR: Failure: ... (No module ...apackagethatdoesntexist...)
0504c5
     ----------------------------------------------------------------------
0504c5
     Traceback (most recent call last):
0504c5
     ...
0504c5
-    ImportError: No module ...apackagethatdoesntexist...
0504c5
+    ...: No module ...apackagethatdoesntexist...
0504c5
     <BLANKLINE>
0504c5
     ======================================================================
0504c5
     FAIL: test_b.test_fail
0504c5
@@ -35,14 +35,14 @@ Addressing failures works (sometimes).
0504c5
     >>> argv.append('1')
0504c5
     >>> _junk = sys.modules.pop('test_a', None) # 2.3 requires
0504c5
     >>> run(argv=argv, plugins=[TestId()]) #doctest: +ELLIPSIS
0504c5
-    #1 Failure: ImportError (No module ...apackagethatdoesntexist...) ... ERROR
0504c5
+    #1 Failure: ... (No module ...apackagethatdoesntexist...) ... ERROR
0504c5
     <BLANKLINE>
0504c5
     ======================================================================
0504c5
-    ERROR: Failure: ImportError (No module ...apackagethatdoesntexist...)
0504c5
+    ERROR: Failure: ... (No module ...apackagethatdoesntexist...)
0504c5
     ----------------------------------------------------------------------
0504c5
     Traceback (most recent call last):
0504c5
     ...
0504c5
-    ImportError: No module ...apackagethatdoesntexist...
0504c5
+    ...: No module ...apackagethatdoesntexist...
0504c5
     <BLANKLINE>
0504c5
     ----------------------------------------------------------------------
0504c5
     Ran 1 test in ...s
0504c5
-- 
0504c5
2.11.0
0504c5