mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-119064: Use os_helper.FakePath instead of pathlib.Path in tests (GH-119065)
This commit is contained in:
parent
0142a2292c
commit
0152dc4ff5
19 changed files with 115 additions and 127 deletions
|
@ -25,7 +25,6 @@ import threading
|
|||
import gc
|
||||
import textwrap
|
||||
import json
|
||||
import pathlib
|
||||
from test.support.os_helper import FakePath
|
||||
|
||||
try:
|
||||
|
@ -1522,9 +1521,6 @@ class ProcessTestCase(BaseTestCase):
|
|||
p.communicate(b"x" * 2**20)
|
||||
|
||||
def test_repr(self):
|
||||
path_cmd = pathlib.Path("my-tool.py")
|
||||
pathlib_cls = path_cmd.__class__.__name__
|
||||
|
||||
cases = [
|
||||
("ls", True, 123, "<Popen: returncode: 123 args: 'ls'>"),
|
||||
('a' * 100, True, 0,
|
||||
|
@ -1532,7 +1528,8 @@ class ProcessTestCase(BaseTestCase):
|
|||
(["ls"], False, None, "<Popen: returncode: None args: ['ls']>"),
|
||||
(["ls", '--my-opts', 'a' * 100], False, None,
|
||||
"<Popen: returncode: None args: ['ls', '--my-opts', 'aaaaaaaaaaaaaaaaaaaaaaaa...>"),
|
||||
(path_cmd, False, 7, f"<Popen: returncode: 7 args: {pathlib_cls}('my-tool.py')>")
|
||||
(os_helper.FakePath("my-tool.py"), False, 7,
|
||||
"<Popen: returncode: 7 args: <FakePath 'my-tool.py'>>")
|
||||
]
|
||||
with unittest.mock.patch.object(subprocess.Popen, '_execute_child'):
|
||||
for cmd, shell, code, sx in cases:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue