Skip to content

Commit

Permalink
Fix flake8 report
Browse files Browse the repository at this point in the history
Signed-off-by: Nig3l <[email protected]>
  • Loading branch information
Ni-g-3l committed Nov 11, 2024
1 parent f8a8f49 commit da9e66c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
8 changes: 5 additions & 3 deletions src/rez/plugin_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,11 @@ def register_plugin_module(self, plugin_name, plugin_module, plugin_path):

plugin_class = plugin_module.register_plugin()
if plugin_class is not None:
self.register_plugin(plugin_name,
plugin_class,
plugin_module)
self.register_plugin(
plugin_name,
plugin_class,
plugin_module
)
else:
if config.debug("plugins"):
print_warning(
Expand Down
10 changes: 5 additions & 5 deletions src/rez/tests/test_plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def setUp(self):
TestBase.setUp(self)
self._reset_plugin_manager()

def _test_load_plugin_from_plugin_path(self):
def test_load_plugin_from_plugin_path(self):
"""Test loading rez plugin from plugin_path"""
self.update_settings(dict(
plugin_path=[self.data_path("extensions", "foo")]
Expand All @@ -60,7 +60,7 @@ def _test_load_plugin_from_plugin_path(self):
"package_repository", "cloud")
self.assertEqual(cloud_cls.name(), "cloud")

def _test_load_plugin_from_python_module(self):
def test_load_plugin_from_python_module(self):
"""Test loading rez plugin from python modules"""
with restore_sys_path():
sys.path.append(self.data_path("extensions"))
Expand All @@ -76,7 +76,7 @@ def test_load_plugin_from_entry_points(self):
"command", "baz")
self.assertEqual(baz_cls.name(), "baz")

def _test_plugin_override_1(self):
def test_plugin_override_1(self):
"""Test plugin from plugin_path can override the default"""
self.update_settings(dict(
plugin_path=[self.data_path("extensions", "non-mod")]
Expand All @@ -86,7 +86,7 @@ def _test_plugin_override_1(self):
"package_repository", "memory")
self.assertEqual("non-mod", mem_cls.on_test)

def _test_plugin_override_2(self):
def test_plugin_override_2(self):
"""Test plugin from python modules can override the default"""
with restore_sys_path():
sys.path.append(self.data_path("extensions"))
Expand All @@ -95,7 +95,7 @@ def _test_plugin_override_2(self):
"package_repository", "memory")
self.assertEqual("bar", mem_cls.on_test)

def _test_plugin_override_3(self):
def test_plugin_override_3(self):
"""Test plugin from python modules can override plugin_path"""
with restore_sys_path():
# setup new
Expand Down
8 changes: 4 additions & 4 deletions src/rez/tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ def wrapper(self, *args, **kwargs):
return decorator



_restore_sys_path_lock = threading.Lock()
_restore_os_environ_lock = threading.Lock()
_restore_pip_lock = threading.Lock()
Expand Down Expand Up @@ -365,13 +364,14 @@ def restore_os_environ():
os.environ.clear()
os.environ.update(original)


@contextmanager
def restore_pip(package_name, package_path):
from pip._internal import main as pipmain

with _restore_pip_lock:
pipmain(['install', package_path])

yield True

pipmain(['uninstall', package_name, "-y"])
pipmain(['uninstall', package_name, "-y"])

0 comments on commit da9e66c

Please sign in to comment.