Skip to content

Commit 2d5c7d5

Browse files
authored
Merge pull request #4237 from Avasam/change-py-for-pathlib
Use `pathlib` instead of `py`
2 parents ecfd1ce + c6ebe3d commit 2d5c7d5

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

newsfragments/4237.misc.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Drop dependency on `py`. Bump ``pytest-xdist`` to ``>=3`` and use `pathlib` instead in tests -- by :user:`Avasam`

pkg_resources/tests/test_find_distributions.py

+16-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import py
1+
from pathlib import Path
2+
import shutil
23
import pytest
34
import pkg_resources
45

56

6-
TESTS_DATA_DIR = py.path.local(__file__).dirpath('data')
7+
TESTS_DATA_DIR = Path(__file__).parent / 'data'
78

89

910
class TestFindDistributions:
@@ -19,21 +20,31 @@ def test_non_egg_dir_named_egg(self, target_dir):
1920
assert not list(dists)
2021

2122
def test_standalone_egg_directory(self, target_dir):
22-
(TESTS_DATA_DIR / 'my-test-package_unpacked-egg').copy(target_dir)
23+
shutil.copytree(
24+
TESTS_DATA_DIR / 'my-test-package_unpacked-egg',
25+
target_dir,
26+
dirs_exist_ok=True,
27+
)
2328
dists = pkg_resources.find_distributions(str(target_dir))
2429
assert [dist.project_name for dist in dists] == ['my-test-package']
2530
dists = pkg_resources.find_distributions(str(target_dir), only=True)
2631
assert not list(dists)
2732

2833
def test_zipped_egg(self, target_dir):
29-
(TESTS_DATA_DIR / 'my-test-package_zipped-egg').copy(target_dir)
34+
shutil.copytree(
35+
TESTS_DATA_DIR / 'my-test-package_zipped-egg',
36+
target_dir,
37+
dirs_exist_ok=True,
38+
)
3039
dists = pkg_resources.find_distributions(str(target_dir))
3140
assert [dist.project_name for dist in dists] == ['my-test-package']
3241
dists = pkg_resources.find_distributions(str(target_dir), only=True)
3342
assert not list(dists)
3443

3544
def test_zipped_sdist_one_level_removed(self, target_dir):
36-
(TESTS_DATA_DIR / 'my-test-package-zip').copy(target_dir)
45+
shutil.copytree(
46+
TESTS_DATA_DIR / 'my-test-package-zip', target_dir, dirs_exist_ok=True
47+
)
3748
dists = pkg_resources.find_distributions(
3849
str(target_dir / "my-test-package.zip")
3950
)

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ testing =
6060
pip>=19.1 # For proper file:// URLs support.
6161
packaging>=23.2
6262
jaraco.envs>=2.2
63-
pytest-xdist
63+
pytest-xdist>=3 # Dropped dependency on pytest-fork and py
6464
jaraco.path>=3.2.0
6565
build[virtualenv]
6666
filelock>=3.4.0

0 commit comments

Comments
 (0)