@@ -23,65 +23,72 @@ def inwd(wd):
23
23
yield wd
24
24
25
25
26
+ def _sep (paths ):
27
+ return {
28
+ path .replace ('/' , os .path .sep )
29
+ for path in paths
30
+ }
31
+
32
+
26
33
def test_basic (inwd ):
27
- assert set (find_files ()) == {
34
+ assert set (find_files ()) == _sep ( {
28
35
'file1' ,
29
36
'adir/filea' ,
30
37
'bdir/fileb' ,
31
- }
32
- assert set (find_files ('.' )) == {
38
+ })
39
+ assert set (find_files ('.' )) == _sep ( {
33
40
'./file1' ,
34
41
'./adir/filea' ,
35
42
'./bdir/fileb' ,
36
- }
37
- assert set (find_files ('adir' )) == {
43
+ })
44
+ assert set (find_files ('adir' )) == _sep ( {
38
45
'adir/filea' ,
39
- }
46
+ })
40
47
41
48
42
49
def test_case (inwd ):
43
50
(inwd .cwd / 'CamelFile' ).ensure (file = True )
44
51
(inwd .cwd / 'file2' ).ensure (file = True )
45
52
inwd .add_and_commit ()
46
- assert set (find_files ()) == {
53
+ assert set (find_files ()) == _sep ( {
47
54
'CamelFile' ,
48
55
'file2' ,
49
56
'file1' ,
50
57
'adir/filea' ,
51
58
'bdir/fileb' ,
52
- }
59
+ })
53
60
54
61
55
62
@pytest .mark .skipif (sys .platform == 'win32' ,
56
63
reason = "symlinks to dir not supported" )
57
64
def test_symlink_dir (inwd ):
58
65
(inwd .cwd / 'adir' / 'bdirlink' ).mksymlinkto ('../bdir' )
59
66
inwd .add_and_commit ()
60
- assert set (find_files ('adir' )) == {
67
+ assert set (find_files ('adir' )) == _sep ( {
61
68
'adir/filea' ,
62
69
'adir/bdirlink/fileb' ,
63
- }
70
+ })
64
71
65
72
66
73
@pytest .mark .skipif (sys .platform == 'win32' ,
67
74
reason = "symlinks to files not supported on windows" )
68
75
def test_symlink_file (inwd ):
69
76
(inwd .cwd / 'adir' / 'file1link' ).mksymlinkto ('../file1' )
70
77
inwd .add_and_commit ()
71
- assert set (find_files ('adir' )) == {
78
+ assert set (find_files ('adir' )) == _sep ( {
72
79
'adir/filea' ,
73
80
'adir/file1link' ,
74
- }
81
+ })
75
82
76
83
77
84
@pytest .mark .skipif (sys .platform == 'win32' ,
78
85
reason = "symlinks to dir not supported" )
79
86
def test_symlink_loop (inwd ):
80
87
(inwd .cwd / 'adir' / 'loop' ).mksymlinkto ('../adir' )
81
88
inwd .add_and_commit ()
82
- assert set (find_files ('adir' )) == {
89
+ assert set (find_files ('adir' )) == _sep ( {
83
90
'adir/filea' ,
84
- }
91
+ })
85
92
86
93
87
94
@pytest .mark .skipif (sys .platform == 'win32' ,
@@ -90,37 +97,37 @@ def test_symlink_dir_out_of_git(inwd):
90
97
(inwd .cwd / 'adir' / 'outsidedirlink' ).\
91
98
mksymlinkto (os .path .join (__file__ , '..' ))
92
99
inwd .add_and_commit ()
93
- assert set (find_files ('adir' )) == {
100
+ assert set (find_files ('adir' )) == _sep ( {
94
101
'adir/filea' ,
95
- }
102
+ })
96
103
97
104
98
105
@pytest .mark .skipif (sys .platform == 'win32' ,
99
106
reason = "symlinks to files not supported on windows" )
100
107
def test_symlink_file_out_of_git (inwd ):
101
108
(inwd .cwd / 'adir' / 'outsidefilelink' ).mksymlinkto (__file__ )
102
109
inwd .add_and_commit ()
103
- assert set (find_files ('adir' )) == {
110
+ assert set (find_files ('adir' )) == _sep ( {
104
111
'adir/filea' ,
105
- }
112
+ })
106
113
107
114
108
115
def test_empty_root (inwd ):
109
116
subdir = inwd .cwd / 'cdir' / 'subdir'
110
117
subdir .ensure (dir = True )
111
118
(subdir / 'filec' ).ensure (file = True )
112
119
inwd .add_and_commit ()
113
- assert set (find_files ('cdir' )) == {
120
+ assert set (find_files ('cdir' )) == _sep ( {
114
121
'cdir/subdir/filec' ,
115
- }
122
+ })
116
123
117
124
118
125
def test_empty_subdir (inwd ):
119
126
subdir = inwd .cwd / 'adir' / 'emptysubdir' / 'subdir'
120
127
subdir .ensure (dir = True )
121
128
(subdir / 'xfile' ).ensure (file = True )
122
129
inwd .add_and_commit ()
123
- assert set (find_files ('adir' )) == {
130
+ assert set (find_files ('adir' )) == _sep ( {
124
131
'adir/filea' ,
125
132
'adir/emptysubdir/subdir/xfile' ,
126
- }
133
+ })
0 commit comments