From f872fcb5d0ba99bce5b1017c067d3b18ecccf15c Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sat, 25 Aug 2018 17:33:29 -0300 Subject: [PATCH] Remove dangerous sys.path manipulations in test_pluginmanager Noticed these while working in something else --- testing/test_pluginmanager.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/testing/test_pluginmanager.py b/testing/test_pluginmanager.py index 958dfc650..39f5fb91f 100644 --- a/testing/test_pluginmanager.py +++ b/testing/test_pluginmanager.py @@ -25,7 +25,6 @@ class TestPytestPluginInteractions(object): ) conf = testdir.makeconftest( """ - import sys ; sys.path.insert(0, '.') import newhooks def pytest_addhooks(pluginmanager): pluginmanager.addhooks(newhooks) @@ -263,8 +262,7 @@ class TestPytestPluginManager(object): mod.pytest_plugins = "pytest_a" aplugin = testdir.makepyfile(pytest_a="#") reprec = testdir.make_hook_recorder(pytestpm) - # syspath.prepend(aplugin.dirpath()) - sys.path.insert(0, str(aplugin.dirpath())) + testdir.syspathinsert(aplugin.dirpath()) pytestpm.consider_module(mod) call = reprec.getcall(pytestpm.hook.pytest_plugin_registered.name) assert call.plugin.__name__ == "pytest_a"