1
- import py
1
+ from pathlib import Path
2
2
import pytest
3
3
import pkg_resources
4
4
5
5
6
- TESTS_DATA_DIR = py . path . local (__file__ ).dirpath ( 'data' )
6
+ TESTS_DATA_DIR = Path (__file__ ).parent / 'data'
7
7
8
8
9
9
class TestFindDistributions :
@@ -19,21 +19,27 @@ def test_non_egg_dir_named_egg(self, target_dir):
19
19
assert not list (dists )
20
20
21
21
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
+ )
23
25
dists = pkg_resources .find_distributions (str (target_dir ))
24
26
assert [dist .project_name for dist in dists ] == ['my-test-package' ]
25
27
dists = pkg_resources .find_distributions (str (target_dir ), only = True )
26
28
assert not list (dists )
27
29
28
30
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
+ )
30
34
dists = pkg_resources .find_distributions (str (target_dir ))
31
35
assert [dist .project_name for dist in dists ] == ['my-test-package' ]
32
36
dists = pkg_resources .find_distributions (str (target_dir ), only = True )
33
37
assert not list (dists )
34
38
35
39
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
+ )
37
43
dists = pkg_resources .find_distributions (
38
44
str (target_dir / "my-test-package.zip" )
39
45
)
0 commit comments