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