Skip to content

Commit 6fe9ee6

Browse files
committed
pytest: replace fspath with path
1 parent 3505ad7 commit 6fe9ee6

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tests/conftest.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535

3636
def pytest_collect_file(parent, path):
3737
if path.basename == "verify":
38-
return LocalRepo.from_parent(parent, fspath=path)
38+
return LocalRepo.from_parent(parent, path=path)
3939
elif path.basename.endswith(".repos.yaml"):
40-
return RemoteRepoList.from_parent(parent, fspath=path)
40+
return RemoteRepoList.from_parent(parent, path=path)
4141

4242

4343
def make_test_func(args, skip_build=False, extra_run_kwargs=None):
@@ -213,7 +213,7 @@ def __init__(
213213
super().__init__(name, parent, callobj=f)
214214

215215
def reportinfo(self):
216-
return (self.parent.fspath, None, "")
216+
return (self.parent.path, None, "")
217217

218218
def repr_failure(self, excinfo):
219219
err = excinfo.value
@@ -233,24 +233,24 @@ def collect(self):
233233
args = ["--appendix", 'RUN echo "appendix" > /tmp/appendix']
234234
# If there's an extra-args.yaml file in a test dir, assume it contains
235235
# a yaml list with extra arguments to be passed to repo2docker
236-
extra_args_path = os.path.join(self.fspath.dirname, "test-extra-args.yaml")
236+
extra_args_path = os.path.join(self.path.dirname, "test-extra-args.yaml")
237237
if os.path.exists(extra_args_path):
238238
with open(extra_args_path) as f:
239239
extra_args = yaml.safe_load(f)
240240
args += extra_args
241241

242-
print(self.fspath.basename, self.fspath.dirname, str(self.fspath))
242+
print(self.path.basename, self.path.dirname, str(self.path))
243243
# re-use image name for multiple tests of the same image
244244
# so we don't run through the build twice
245-
rel_repo_dir = os.path.relpath(self.fspath.dirname, TESTS_DIR)
245+
rel_repo_dir = os.path.relpath(self.path.dirname, TESTS_DIR)
246246
image_name = f"r2d-tests-{escapism.escape(rel_repo_dir, escape_char='-').lower()}-{int(time.time())}"
247247
args.append(f"--image-name={image_name}")
248-
args.append(self.fspath.dirname)
248+
args.append(self.path.dirname)
249249
yield Repo2DockerTest.from_parent(self, name="build", args=args)
250250

251251
yield Repo2DockerTest.from_parent(
252252
self,
253-
name=self.fspath.basename,
253+
name=self.path.basename,
254254
args=args + ["./verify"],
255255
skip_build=True,
256256
)
@@ -273,7 +273,7 @@ def collect(self):
273273

274274
class RemoteRepoList(pytest.File):
275275
def collect(self):
276-
with self.fspath.open() as f:
276+
with self.path.open() as f:
277277
repos = yaml.safe_load(f)
278278
for repo in repos:
279279
args = []

0 commit comments

Comments
 (0)