Skip to content

Commit

Permalink
Drop dependency on py
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Feb 26, 2024
1 parent 8c45d6e commit 326cec2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions newsfragments/4237.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Drop dependency on `py`. Bump ``pytest-xdist`` to ``>=3`` and use `pathlib` instead in tests -- by :user:`Avasam`
11 changes: 6 additions & 5 deletions pkg_resources/tests/test_find_distributions.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import py
from pathlib import Path
import shutil
import pytest
import pkg_resources


TESTS_DATA_DIR = py.path.local(__file__).dirpath('data')
TESTS_DATA_DIR = Path(__file__).parent / 'data'


class TestFindDistributions:
Expand All @@ -19,21 +20,21 @@ def test_non_egg_dir_named_egg(self, target_dir):
assert not list(dists)

def test_standalone_egg_directory(self, target_dir):
(TESTS_DATA_DIR / 'my-test-package_unpacked-egg').copy(target_dir)
shutil.copy(TESTS_DATA_DIR / 'my-test-package_unpacked-egg', target_dir)
dists = pkg_resources.find_distributions(str(target_dir))
assert [dist.project_name for dist in dists] == ['my-test-package']
dists = pkg_resources.find_distributions(str(target_dir), only=True)
assert not list(dists)

def test_zipped_egg(self, target_dir):
(TESTS_DATA_DIR / 'my-test-package_zipped-egg').copy(target_dir)
shutil.copy(TESTS_DATA_DIR / 'my-test-package_zipped-egg', target_dir)
dists = pkg_resources.find_distributions(str(target_dir))
assert [dist.project_name for dist in dists] == ['my-test-package']
dists = pkg_resources.find_distributions(str(target_dir), only=True)
assert not list(dists)

def test_zipped_sdist_one_level_removed(self, target_dir):
(TESTS_DATA_DIR / 'my-test-package-zip').copy(target_dir)
shutil.copy(TESTS_DATA_DIR / 'my-test-package-zip', target_dir)
dists = pkg_resources.find_distributions(
str(target_dir / "my-test-package.zip")
)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ testing =
pip>=19.1 # For proper file:// URLs support.
packaging>=23.2
jaraco.envs>=2.2
pytest-xdist
pytest-xdist>=3 # Dropped dependency on pytest-fork and py
jaraco.path>=3.2.0
build[virtualenv]
filelock>=3.4.0
Expand Down

0 comments on commit 326cec2

Please sign in to comment.