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