Skip to content

Commit

Permalink
Change py for pathlib
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Feb 26, 2024
1 parent 8c45d6e commit 9cbc97b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions pkg_resources/tests/test_find_distributions.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import py
from pathlib import Path
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 +19,27 @@ 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)
(TESTS_DATA_DIR / 'my-test-package_unpacked-egg').write_text(
target_dir.read_text(encoding="utf-8"), encoding="utf-8"
)
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)
(TESTS_DATA_DIR / 'my-test-package_zipped-egg').write_text(
target_dir.read_text(encoding="utf-8"), encoding="utf-8"
)
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)
(TESTS_DATA_DIR / 'my-test-package-zip').write_text(
target_dir.read_text(encoding="utf-8"), encoding="utf-8"
)
dists = pkg_resources.find_distributions(
str(target_dir / "my-test-package.zip")
)
Expand Down

0 comments on commit 9cbc97b

Please sign in to comment.