summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-03-08 20:59:59 (GMT)
committerGitHub <noreply@github.com>2020-03-08 20:59:59 (GMT)
commit0687bdf5def13ddca09e854113c0eac0772afea0 (patch)
tree1251abe8502ddde83771b9e51266396dd605256b /Lib/test
parentb2e8240261aa879b8978d7add6dd1efc4318add1 (diff)
downloadcpython-0687bdf5def13ddca09e854113c0eac0772afea0.zip
cpython-0687bdf5def13ddca09e854113c0eac0772afea0.tar.gz
cpython-0687bdf5def13ddca09e854113c0eac0772afea0.tar.bz2
bpo-39517: Allow runpy.run_path() to accept path-like objects (GH-18699)
(cherry picked from commit 0911ea5c172264eaefa3efe4a1788159c160920d) Co-authored-by: Maor Kleinberger <kmaork@gmail.com>
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_runpy.py9
1 files changed, 9 insertions, 0 deletions
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 tempfile
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 @@ class RunPathTestCase(unittest.TestCase, CodeExecutionMixin):
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'