Skip to content

Commit 9e5fc4b

Browse files
committed
Drop test dependency on path package
1 parent a443f76 commit 9e5fc4b

File tree

6 files changed

+13
-16
lines changed

6 files changed

+13
-16
lines changed

setuptools/tests/config/test_pyprojecttoml.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import jaraco.path
66
import pytest
77
import tomli_w
8-
from path import Path
98

109
import setuptools # noqa: F401 # force distutils.core to be patched
1110
from setuptools.config.pyprojecttoml import (
@@ -363,7 +362,7 @@ def test_include_package_data_in_setuppy(tmp_path):
363362
}
364363
jaraco.path.build(files, prefix=tmp_path)
365364

366-
with Path(tmp_path):
365+
with jaraco.path.DirectoryStack().context(tmp_path):
367366
dist = distutils.core.run_setup("setup.py", {}, stop_after="config")
368367

369368
assert dist.get_name() == "myproj"

setuptools/tests/fixtures.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import sys
55
from pathlib import Path
66

7-
import path
87
import pytest
98

109
from . import contexts, environment
@@ -119,7 +118,7 @@ def setuptools_wheel(tmp_path_factory, request):
119118
def venv(tmp_path, setuptools_wheel):
120119
"""Virtual env with the version of setuptools under test installed"""
121120
env = environment.VirtualEnv()
122-
env.root = path.Path(tmp_path / 'venv')
121+
env.root = Path(tmp_path / 'venv')
123122
env.create_opts = ['--no-setuptools', '--wheel=bundle']
124123
# TODO: Use `--no-wheel` when setuptools implements its own bdist_wheel
125124
env.req = str(setuptools_wheel)
@@ -141,7 +140,7 @@ def venv(tmp_path, setuptools_wheel):
141140
def venv_without_setuptools(tmp_path):
142141
"""Virtual env without any version of setuptools installed"""
143142
env = environment.VirtualEnv()
144-
env.root = path.Path(tmp_path / 'venv_without_setuptools')
143+
env.root = Path(tmp_path / 'venv_without_setuptools')
145144
env.create_opts = ['--no-setuptools', '--no-wheel']
146145
env.ensure_env()
147146
return env
@@ -151,7 +150,7 @@ def venv_without_setuptools(tmp_path):
151150
def bare_venv(tmp_path):
152151
"""Virtual env without any common packages installed"""
153152
env = environment.VirtualEnv()
154-
env.root = path.Path(tmp_path / 'bare_venv')
153+
env.root = Path(tmp_path / 'bare_venv')
155154
env.create_opts = ['--no-setuptools', '--no-pip', '--no-wheel', '--no-seed']
156155
env.ensure_env()
157156
return env

setuptools/tests/test_config_discovery.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
import sys
33
from configparser import ConfigParser
44
from itertools import product
5+
from pathlib import Path
56
from typing import cast
67

78
import jaraco.path
89
import pytest
9-
from path import Path
1010

1111
import setuptools # noqa: F401 # force distutils.core to be patched
1212
from setuptools.command.sdist import sdist
@@ -307,7 +307,7 @@ def test_setupcfg_metadata(self, tmp_path, folder, opts):
307307
assert dist.package_dir
308308
package_path = find_package_path("pkg", dist.package_dir, tmp_path)
309309
assert os.path.exists(package_path)
310-
assert folder in Path(package_path).parts()
310+
assert folder in Path(package_path).parts
311311

312312
_run_build(tmp_path, "--sdist")
313313
dist_file = tmp_path / "dist/pkg-42.tar.gz"
@@ -618,7 +618,7 @@ def _get_dist(dist_path, attrs):
618618

619619
script = dist_path / 'setup.py'
620620
if script.exists():
621-
with Path(dist_path):
621+
with jaraco.path.DirectoryStack().context(dist_path):
622622
dist = cast(
623623
Distribution,
624624
distutils.core.run_setup("setup.py", {}, stop_after="init"),
@@ -628,7 +628,7 @@ def _get_dist(dist_path, attrs):
628628

629629
dist.src_root = root
630630
dist.script_name = "setup.py"
631-
with Path(dist_path):
631+
with jaraco.path.DirectoryStack().context(dist_path):
632632
dist.parse_config_files()
633633

634634
dist.set_defaults()
@@ -641,7 +641,7 @@ def _run_sdist_programatically(dist_path, attrs):
641641
cmd.ensure_finalized()
642642
assert cmd.distribution.packages or cmd.distribution.py_modules
643643

644-
with quiet(), Path(dist_path):
644+
with quiet(), jaraco.path.DirectoryStack().context(dist_path):
645645
cmd.run()
646646

647647
return dist, cmd

setuptools/tests/test_editable_install.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@
1414
from unittest.mock import Mock
1515
from uuid import uuid4
1616

17-
import jaraco.envs
1817
import jaraco.path
1918
import pytest
20-
from path import Path as _Path
2119

2220
from setuptools._importlib import resources as importlib_resources
2321
from setuptools.command.editable_wheel import (
@@ -565,6 +563,8 @@ def test_combine_namespaces_nested(self, tmp_path):
565563
self.install_finder(code)
566564
mod1 = import_module("different_name.my_module")
567565
mod2 = import_module("different_name.subpkg.my_module2")
566+
assert mod1.__file__ is not None
567+
assert mod2.__file__ is not None
568568

569569
expected = str((tmp_path / "src/my_package/my_module.py").resolve())
570570
assert str(Path(mod1.__file__).resolve()) == expected
@@ -972,7 +972,7 @@ class TestLinkTree:
972972
def test_generated_tree(self, tmp_path):
973973
jaraco.path.build(self.FILES, prefix=tmp_path)
974974

975-
with _Path(tmp_path):
975+
with jaraco.path.DirectoryStack().context(tmp_path):
976976
name = "mypkg-3.14159"
977977
dist = Distribution({"script_name": "%PEP 517%"})
978978
dist.parse_config_files()

tools/vendored.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import functools
22
import re
33
import subprocess
4+
from pathlib import Path
45

56
import jaraco.packaging.metadata
6-
from path import Path
77

88

99
def remove_all(paths):

tox.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ commands =
7272
[testenv:vendor]
7373
skip_install = True
7474
deps =
75-
path
7675
jaraco.packaging
7776
# workaround for pypa/pyproject-hooks#192
7877
pyproject-hooks!=1.1

0 commit comments

Comments
 (0)