From c7d0f3cf88f22f2a868611d93d23c36881a28a58 Mon Sep 17 00:00:00 2001 From: gfyoung Date: Tue, 21 Aug 2018 22:54:28 -0700 Subject: [PATCH] MAINT: Reset sys.path if docstrings import fails Follow-up to gh-22413. --- pandas/tests/scripts/test_validate_docstrings.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pandas/tests/scripts/test_validate_docstrings.py b/pandas/tests/scripts/test_validate_docstrings.py index cebcbf5a61465..29da40cd78d22 100644 --- a/pandas/tests/scripts/test_validate_docstrings.py +++ b/pandas/tests/scripts/test_validate_docstrings.py @@ -471,6 +471,9 @@ def import_scripts(self): from validate_docstrings import validate_one globals()[global_validate_one] = validate_one except ImportError: + # Remove addition to `sys.path` + sys.path.pop() + # Import will fail if the pandas installation is not inplace. raise pytest.skip("pandas/scripts directory does not exist")