|
33 | 33 | TESTS_DIR = os.path.abspath(os.path.dirname(__file__))
|
34 | 34 |
|
35 | 35 |
|
36 |
| -def pytest_collect_file(parent, path): |
37 |
| - if path.basename == "verify": |
38 |
| - return LocalRepo.from_parent(parent, path=path) |
39 |
| - elif path.basename.endswith(".repos.yaml"): |
40 |
| - return RemoteRepoList.from_parent(parent, path=path) |
| 36 | +def pytest_collect_file(parent, file_path): |
| 37 | + if file_path.name == "verify": |
| 38 | + return LocalRepo.from_parent(parent, path=file_path) |
| 39 | + elif file_path.name.endswith(".repos.yaml"): |
| 40 | + return RemoteRepoList.from_parent(parent, path=file_path) |
41 | 41 |
|
42 | 42 |
|
43 | 43 | def make_test_func(args, skip_build=False, extra_run_kwargs=None):
|
@@ -233,24 +233,23 @@ def collect(self):
|
233 | 233 | args = ["--appendix", 'RUN echo "appendix" > /tmp/appendix']
|
234 | 234 | # If there's an extra-args.yaml file in a test dir, assume it contains
|
235 | 235 | # a yaml list with extra arguments to be passed to repo2docker
|
236 |
| - extra_args_path = os.path.join(self.path.dirname, "test-extra-args.yaml") |
237 |
| - if os.path.exists(extra_args_path): |
238 |
| - with open(extra_args_path) as f: |
239 |
| - extra_args = yaml.safe_load(f) |
| 236 | + extra_args_path = self.path.parent / "test-extra-args.yaml" |
| 237 | + if extra_args_path.exists(): |
| 238 | + extra_args = yaml.safe_load(extra_args_path.read_text()) |
240 | 239 | args += extra_args
|
241 | 240 |
|
242 |
| - print(self.path.basename, self.path.dirname, str(self.path)) |
| 241 | + print(self.path.name, self.path.parent, str(self.path)) |
243 | 242 | # re-use image name for multiple tests of the same image
|
244 | 243 | # so we don't run through the build twice
|
245 |
| - rel_repo_dir = os.path.relpath(self.path.dirname, TESTS_DIR) |
| 244 | + rel_repo_dir = os.path.relpath(self.path.parent, TESTS_DIR) |
246 | 245 | image_name = f"r2d-tests-{escapism.escape(rel_repo_dir, escape_char='-').lower()}-{int(time.time())}"
|
247 | 246 | args.append(f"--image-name={image_name}")
|
248 |
| - args.append(self.path.dirname) |
| 247 | + args.append(str(self.path.parent)) |
249 | 248 | yield Repo2DockerTest.from_parent(self, name="build", args=args)
|
250 | 249 |
|
251 | 250 | yield Repo2DockerTest.from_parent(
|
252 | 251 | self,
|
253 |
| - name=self.path.basename, |
| 252 | + name=self.path.name, |
254 | 253 | args=args + ["./verify"],
|
255 | 254 | skip_build=True,
|
256 | 255 | )
|
|
0 commit comments