Skip to content

Commit

Permalink
Add an additional check in e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
ewjoachim committed Aug 5, 2023
1 parent fc71ff1 commit 56f2ceb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/end_to_end/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ def git_repo(cd, git, action_ref, code_path):
file.read_text()
.replace("__ACTION_REF__", action_ref)
.replace("__ACTION_COVERAGE_PATH__", str(code_path))
.replace("__ACTION_SUBPROJECT_ID__", str(subproject_id))
)
file.write_text(content)

Expand All @@ -239,6 +240,12 @@ def code_path(request):
return pathlib.Path(*mark.args) if mark else pathlib.Path(".")


@pytest.fixture
def subproject_id(request):
mark = request.node.get_closest_marker("subproject_id")
return mark.args[0] if mark else None


@pytest.fixture
def repo_full_name(repo_name, gh_me_username):
return f"{gh_me_username}/{repo_name}"
Expand Down
1 change: 1 addition & 0 deletions tests/end_to_end/repo/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
ANNOTATE_MISSING_LINES: true
ANNOTATION_TYPE: notice
COVERAGE_PATH: __ACTION_COVERAGE_PATH__
SUBPROJECT_ID: __ACTION_SUBPROJECT_ID__

- name: Store Pull Request comment to be posted
uses: actions/upload-artifact@v3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }}
COVERAGE_PATH: __ACTION_COVERAGE_PATH__
SUBPROJECT_ID: __ACTION_SUBPROJECT_ID__
6 changes: 6 additions & 0 deletions tests/end_to_end/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

@pytest.mark.repo_suffix("public")
@pytest.mark.code_path("subdir")
@pytest.mark.subproject_id("my-great-project")
def test_public_repo(
gh_create_repo,
wait_for_run_to_start,
Expand Down Expand Up @@ -124,6 +125,11 @@ def test_public_repo(
fail_value="\n",
)
assert ":arrow_up:" in comment
assert "## Coverage report (my-great-project)" in comment
assert (
"This comment was produced by python-coverage-comment-action (my-great-project)"
in comment
)

# Let's merge the PR and see if everything works fine
gh_me("pr", "merge", "1", "--merge")
Expand Down

0 comments on commit 56f2ceb

Please sign in to comment.