From 09ee452b712015f756c9d3a4f846dfb7fc2938f9 Mon Sep 17 00:00:00 2001 From: Robyn Rindge Date: Wed, 21 Apr 2021 11:24:00 -0700 Subject: [PATCH 1/3] Allow test to run in both python 2.7 and python 3.3+ wrt reloading modules --- tests/test_plugin_detection.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/test_plugin_detection.py b/tests/test_plugin_detection.py index 183ea6e964..d132571080 100644 --- a/tests/test_plugin_detection.py +++ b/tests/test_plugin_detection.py @@ -26,7 +26,6 @@ import os import pkg_resources import sys -import importlib try: # Python 3.3 forward includes the mock module @@ -41,6 +40,11 @@ # Mock appears to not be installed could_import_mock = False +try: + # Python 3.4 forwards use importlib.reload + from importlib import reload as import_reload +except ImportError: + from imp import reload as import_reload import opentimelineio as otio from tests import baseline_reader @@ -102,7 +106,7 @@ def test_detect_plugin(self): def test_pkg_resources_disabled(self): os.environ["OTIO_DISABLE_PKG_RESOURCE_PLUGINS"] = "1" - importlib.reload(otio.plugins.manifest) + import_reload(otio.plugins.manifest) # detection of the environment variable happens on import, force a # reload to ensure that it is triggered @@ -112,7 +116,7 @@ def test_pkg_resources_disabled(self): # remove the environment variable and reload again for usage in the # other tests del os.environ["OTIO_DISABLE_PKG_RESOURCE_PLUGINS"] - importlib.reload(otio.plugins.manifest) + import_reload(otio.plugins.manifest) def test_detect_plugin_json_manifest(self): # Test detecting a plugin that rather than exposing the plugin_manifest From ddf25155867984d055dfd33f8b0ba9c05646b1f4 Mon Sep 17 00:00:00 2001 From: Robyn Rindge Date: Thu, 22 Apr 2021 19:48:41 -0700 Subject: [PATCH 2/3] Update tests/test_plugin_detection.py comment Co-authored-by: Stephan Steinbach <61017+ssteinbach@users.noreply.github.com> --- tests/test_plugin_detection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_plugin_detection.py b/tests/test_plugin_detection.py index d132571080..c6fa240bfc 100644 --- a/tests/test_plugin_detection.py +++ b/tests/test_plugin_detection.py @@ -41,7 +41,7 @@ could_import_mock = False try: - # Python 3.4 forwards use importlib.reload + # Python3: use importlib.reload from importlib import reload as import_reload except ImportError: from imp import reload as import_reload From 92561bb244a0c83b47dbc8026486d82ab5c028db Mon Sep 17 00:00:00 2001 From: Robyn Rindge Date: Thu, 22 Apr 2021 19:48:58 -0700 Subject: [PATCH 3/3] Update tests/test_plugin_detection.py comment Co-authored-by: Stephan Steinbach <61017+ssteinbach@users.noreply.github.com> --- tests/test_plugin_detection.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_plugin_detection.py b/tests/test_plugin_detection.py index c6fa240bfc..6847413256 100644 --- a/tests/test_plugin_detection.py +++ b/tests/test_plugin_detection.py @@ -44,6 +44,7 @@ # Python3: use importlib.reload from importlib import reload as import_reload except ImportError: + # Python2: from imp import reload as import_reload import opentimelineio as otio