Skip to content

Commit 9cbc97b

Browse files
committed
Change py for pathlib
1 parent 8c45d6e commit 9cbc97b

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

pkg_resources/tests/test_find_distributions.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import py
1+
from pathlib import Path
22
import pytest
33
import pkg_resources
44

55

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

88

99
class TestFindDistributions:
@@ -19,21 +19,27 @@ def test_non_egg_dir_named_egg(self, target_dir):
1919
assert not list(dists)
2020

2121
def test_standalone_egg_directory(self, target_dir):
22-
(TESTS_DATA_DIR / 'my-test-package_unpacked-egg').copy(target_dir)
22+
(TESTS_DATA_DIR / 'my-test-package_unpacked-egg').write_text(
23+
target_dir.read_text(encoding="utf-8"), encoding="utf-8"
24+
)
2325
dists = pkg_resources.find_distributions(str(target_dir))
2426
assert [dist.project_name for dist in dists] == ['my-test-package']
2527
dists = pkg_resources.find_distributions(str(target_dir), only=True)
2628
assert not list(dists)
2729

2830
def test_zipped_egg(self, target_dir):
29-
(TESTS_DATA_DIR / 'my-test-package_zipped-egg').copy(target_dir)
31+
(TESTS_DATA_DIR / 'my-test-package_zipped-egg').write_text(
32+
target_dir.read_text(encoding="utf-8"), encoding="utf-8"
33+
)
3034
dists = pkg_resources.find_distributions(str(target_dir))
3135
assert [dist.project_name for dist in dists] == ['my-test-package']
3236
dists = pkg_resources.find_distributions(str(target_dir), only=True)
3337
assert not list(dists)
3438

3539
def test_zipped_sdist_one_level_removed(self, target_dir):
36-
(TESTS_DATA_DIR / 'my-test-package-zip').copy(target_dir)
40+
(TESTS_DATA_DIR / 'my-test-package-zip').write_text(
41+
target_dir.read_text(encoding="utf-8"), encoding="utf-8"
42+
)
3743
dists = pkg_resources.find_distributions(
3844
str(target_dir / "my-test-package.zip")
3945
)

0 commit comments

Comments
 (0)