From 9128b9cdb8530c4004dc758fbf7d1e3944931ab4 Mon Sep 17 00:00:00 2001 From: Brandon Butler Date: Fri, 27 Oct 2023 16:24:16 -0400 Subject: [PATCH] test: Fix path test for CI with detailed comment on necessity --- tests/test_project.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/test_project.py b/tests/test_project.py index 385e7836d..cc485b517 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -2598,7 +2598,9 @@ def operation_info(self, request): ids=None if skip_git else ("git-dirty", "git-clean"), ) def git_repo(self, project, request): - if request.param is None: + # params=None is equivalent to not passing a parameter which results in + # result.param being unset. + if not hasattr(request, "param"): return repo = git.Repo.init(project.path) with open(project.fn("test.txt"), "w"): @@ -2644,7 +2646,15 @@ def check_metadata( repo, ): assert metadata["stage"] == expected_stage - assert job.project.path == metadata["project"]["path"] + # When running on MacOS CI a private/ is prepended to job.project.path + # when querying the path on a fork. Since for local tests to work we + # cannot modify anything, the best we can do is either check for the + # private prefix and remove or check for the stored path being a subset + # of the current path. + test_path = metadata["project"]["path"] + if "private" in test_path: + test_path = os.path.join(*test_path.split(os.path.sep)[1:]) + assert job.project.path == test_path assert metadata["project"]["schema_version"] == job.project.config.get( "schema_version" )