mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +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
|
@ -24,7 +24,7 @@ from test.support import (captured_stdout, captured_stderr,
|
|||
requires_venv_with_pip, TEST_HOME_DIR,
|
||||
requires_resource, copy_python_src_ignore)
|
||||
from test.support.os_helper import (can_symlink, EnvironmentVarGuard, rmtree,
|
||||
TESTFN)
|
||||
TESTFN, FakePath)
|
||||
import unittest
|
||||
import venv
|
||||
from unittest.mock import patch, Mock
|
||||
|
@ -125,12 +125,12 @@ class BasicTest(BaseTest):
|
|||
self.run_with_capture(venv.create, self.env_dir)
|
||||
self._check_output_of_default_create()
|
||||
|
||||
def test_defaults_with_pathlib_path(self):
|
||||
def test_defaults_with_pathlike(self):
|
||||
"""
|
||||
Test the create function with default arguments and a pathlib.Path path.
|
||||
Test the create function with default arguments and a path-like path.
|
||||
"""
|
||||
rmtree(self.env_dir)
|
||||
self.run_with_capture(venv.create, pathlib.Path(self.env_dir))
|
||||
self.run_with_capture(venv.create, FakePath(self.env_dir))
|
||||
self._check_output_of_default_create()
|
||||
|
||||
def _check_output_of_default_create(self):
|
||||
|
@ -572,7 +572,7 @@ class BasicTest(BaseTest):
|
|||
rmtree(self.env_dir)
|
||||
bad_itempath = self.env_dir + os.pathsep
|
||||
self.assertRaises(ValueError, venv.create, bad_itempath)
|
||||
self.assertRaises(ValueError, venv.create, pathlib.Path(bad_itempath))
|
||||
self.assertRaises(ValueError, venv.create, FakePath(bad_itempath))
|
||||
|
||||
@unittest.skipIf(os.name == 'nt', 'not relevant on Windows')
|
||||
@requireVenvCreate
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue