bpo-39517: Allow runpy.run_path() to accept path-like objects (GH-18699)
diff --git a/Lib/test/test_runpy.py b/Lib/test/test_runpy.py
index f003086..84834d3 100644
--- a/Lib/test/test_runpy.py
+++ b/Lib/test/test_runpy.py
@@ -8,6 +8,7 @@
import importlib, importlib.machinery, importlib.util
import py_compile
import warnings
+import pathlib
from test.support import (
forget, make_legacy_pyc, unload, verbose, no_tracing,
create_empty_file, temp_dir)
@@ -652,6 +653,14 @@
self._check_script(script_name, "<run_path>", script_name,
script_name, expect_spec=False)
+ def test_basic_script_with_path_object(self):
+ with temp_dir() as script_dir:
+ mod_name = 'script'
+ script_name = pathlib.Path(self._make_test_script(script_dir,
+ mod_name))
+ self._check_script(script_name, "<run_path>", script_name,
+ script_name, expect_spec=False)
+
def test_basic_script_no_suffix(self):
with temp_dir() as script_dir:
mod_name = 'script'