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