From 98372a94598eef79cf10a74c7081b707a853b233 2021-11-09 00:11:01 From: Nikita Kniazev Date: 2021-11-09 00:11:01 Subject: [PATCH] Add Path support to ipexec --- diff --git a/IPython/core/tests/test_profile.py b/IPython/core/tests/test_profile.py index 2732a8c..8dd58cc 100644 --- a/IPython/core/tests/test_profile.py +++ b/IPython/core/tests/test_profile.py @@ -91,7 +91,7 @@ class ProfileStartupTest(TestCase): f.write(test) def validate(self, output): - tt.ipexec_validate(self.fname, output, '', options=self.options) + tt.ipexec_validate(self.fname, output, "", options=self.options) def test_startup_py(self): self.init('00-start.py', 'zzz=123\n', 'print(zzz)\n') diff --git a/IPython/testing/tools.py b/IPython/testing/tools.py index 10bd4b6..d1e5730 100644 --- a/IPython/testing/tools.py +++ b/IPython/testing/tools.py @@ -177,7 +177,7 @@ def ipexec(fname, options=None, commands=()): Parameters ---------- - fname : str + fname : str, Path Name of file to be executed (should have .py or .ipy extension). options : optional, list @@ -200,6 +200,9 @@ def ipexec(fname, options=None, commands=()): # Absolute path for filename full_fname = os.path.join(test_dir, fname) full_cmd = ipython_cmd + cmdargs + ['--', full_fname] + if sys.platform == "win32" and sys.version_info < (3, 8): + # subprocess.Popen does not support Path objects yet + full_cmd = list(map(str, full_cmd)) env = os.environ.copy() # FIXME: ignore all warnings in ipexec while we have shims # should we keep suppressing warnings here, even after removing shims? @@ -232,7 +235,7 @@ def ipexec_validate(fname, expected_out, expected_err='', Parameters ---------- - fname : str + fname : str, Path Name of the file to be executed (should have .py or .ipy extension). expected_out : str