From 77c6dfcc8e26709c7872edad3dc4f090e9fdb680 Mon Sep 17 00:00:00 2001 From: Simon Li Date: Sun, 3 Mar 2024 19:25:38 +0000 Subject: [PATCH] pytest==8.0.2 --- dev-requirements.txt | 2 +- tests/conftest.py | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index af97237..7dccbf2 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,4 +1,4 @@ build==1.0.3 jupyter-repo2docker==2023.6.0 -pytest==7.4.4 +pytest==8.0.2 pre-commit==3.6.2 diff --git a/tests/conftest.py b/tests/conftest.py index 0bd665d..9046f7c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -22,11 +22,11 @@ CONTAINER_ENGINE = os.getenv("CONTAINER_ENGINE") -def pytest_collect_file(parent, path): - if path.basename == "verify": - return LocalRepo.from_parent(parent, fspath=path) - # elif path.basename.endswith(".repos.yaml"): - # return RemoteRepoList(path, parent) +def pytest_collect_file(parent, file_path): + if file_path.name == "verify": + return LocalRepo.from_parent(parent, path=file_path) + # elif file_path.name.endswith(".repos.yaml"): + # return RemoteRepoList.from_parent(parent, path=file_path) def make_test_func(args): @@ -82,7 +82,7 @@ def __init__(self, name, parent, args): super().__init__(name, parent, callobj=f) def reportinfo(self): - return self.parent.fspath, None, "" + return self.parent.path, None, "" def repr_failure(self, excinfo): err = excinfo.value @@ -108,15 +108,14 @@ def collect(self): args.append(f"--PodmanEngine.podman_executable={CONTAINER_ENGINE}") # If there's an extra-args.yaml file in a test dir, assume it contains # a yaml list with extra arguments to be passed to repo2docker - extra_args_path = os.path.join(self.fspath.dirname, "extra-args.yaml") - if os.path.exists(extra_args_path): - with open(extra_args_path) as f: - extra_args = yaml.safe_load(f) + extra_args_path = self.path.parent / "test-extra-args.yaml" + if extra_args_path.exists(): + extra_args = yaml.safe_load(extra_args_path.read_text()) args += extra_args - args.append(self.fspath.dirname) + args.append(str(self.path.parent)) yield Repo2DockerTest.from_parent(self, name="build", args=args) yield Repo2DockerTest.from_parent( - self, name=self.fspath.basename, args=args + ["./verify"] + self, name=self.path.name, args=args + ["./verify"] )