File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 2
2
import os
3
3
import sys
4
4
import yaml
5
+ from pathlib import Path
5
6
6
7
import pytest
7
8
@@ -14,9 +15,9 @@ def pytest_collect_file(parent, path):
14
15
f = None
15
16
ext = path .ext
16
17
if ext == ".csv" :
17
- f = CSVFile .from_parent (parent , fspath = path )
18
+ f = CSVFile .from_parent (parent , path = Path ( path ) )
18
19
if ext == ".yml" :
19
- f = YamlFile .from_parent (parent , fspath = path )
20
+ f = YamlFile .from_parent (parent , path = Path ( path ) )
20
21
return f
21
22
22
23
@@ -132,7 +133,7 @@ def pytest_runtest_logreport(report):
132
133
class CSVFile (pytest .File ):
133
134
134
135
def collect (self ):
135
- with self .fspath .open (encoding = "utf-8" ) as f :
136
+ with self .path .open (encoding = "utf-8" ) as f :
136
137
dialect = csv .Sniffer ().sniff (f .read (2000 ))
137
138
f .seek (0 )
138
139
reader = csv .DictReader (f , dialect = dialect )
@@ -143,7 +144,7 @@ def collect(self):
143
144
class YamlFile (pytest .File ):
144
145
145
146
def collect (self ):
146
- raw = yaml .safe_load (self .fspath .open (encoding = "utf-8" ))
147
+ raw = yaml .safe_load (self .path .open (encoding = "utf-8" ))
147
148
for name , spec in raw .items ():
148
149
yield YamlItem .from_parent (self , name = name , spec = spec )
149
150
You can’t perform that action at this time.
0 commit comments