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 5f0a3fc
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 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,18 @@ 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
# seemingly indeterminetly. If metadata["project"]["path"] is checked
# then job.project.path will have "private" in it. If I check
# job.project.path then metadata["project"]["path"] will have "private"
# in it. If I check neither, one of them will have "private" in it.
test_path = metadata["project"]["path"]
current_path = job.project.path
if "private" in test_path:
test_path = os.path.join(*test_path.split(os.path.sep)[1:])
if "private" in current_path:
current_path = os.path.join(*current_path.split(os.path.sep)[1:])
assert current_path == test_path
assert metadata["project"]["schema_version"] == job.project.config.get(
"schema_version"
)
Expand Down

0 comments on commit 5f0a3fc

Please sign in to comment.