Skip to content

Commit

Permalink
test: Fix path test for CI with detailed comment on necessity
Browse files Browse the repository at this point in the history
  • Loading branch information
b-butler committed Oct 30, 2023
1 parent 8888e47 commit 9128b9c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand Down Expand Up @@ -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"
)
Expand Down

0 comments on commit 9128b9c

Please sign in to comment.