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