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