Skip to content

Commit c562ec5

Browse files
committed
Add an additional check in e2e
1 parent 118e63e commit c562ec5

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

tests/end_to_end/conftest.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def gh_other_username(gh_other):
191191

192192

193193
@pytest.fixture
194-
def git_repo(cd, git, action_ref, code_path):
194+
def git_repo(cd, git, action_ref, code_path, subproject_id):
195195
with cd("repo") as repo:
196196
git("init", "-b", "main")
197197
# Copy .github
@@ -213,6 +213,7 @@ def git_repo(cd, git, action_ref, code_path):
213213
file.read_text()
214214
.replace("__ACTION_REF__", action_ref)
215215
.replace("__ACTION_COVERAGE_PATH__", str(code_path))
216+
.replace("__ACTION_SUBPROJECT_ID__", str(subproject_id))
216217
)
217218
file.write_text(content)
218219

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

241242

243+
@pytest.fixture
244+
def subproject_id(request):
245+
mark = request.node.get_closest_marker("subproject_id")
246+
return mark.args[0] if mark else None
247+
248+
242249
@pytest.fixture
243250
def repo_full_name(repo_name, gh_me_username):
244251
return f"{gh_me_username}/{repo_name}"

tests/end_to_end/repo/.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
ANNOTATE_MISSING_LINES: true
4242
ANNOTATION_TYPE: notice
4343
COVERAGE_PATH: __ACTION_COVERAGE_PATH__
44+
SUBPROJECT_ID: __ACTION_SUBPROJECT_ID__
4445

4546
- name: Store Pull Request comment to be posted
4647
uses: actions/upload-artifact@v3

tests/end_to_end/repo/.github/workflows/coverage-comment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ jobs:
2222
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2323
GITHUB_PR_RUN_ID: ${{ github.event.workflow_run.id }}
2424
COVERAGE_PATH: __ACTION_COVERAGE_PATH__
25+
SUBPROJECT_ID: __ACTION_SUBPROJECT_ID__

tests/end_to_end/test_all.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
@pytest.mark.repo_suffix("public")
88
@pytest.mark.code_path("subdir")
9+
@pytest.mark.subproject_id("my-great-project")
910
def test_public_repo(
1011
gh_create_repo,
1112
wait_for_run_to_start,
@@ -124,6 +125,11 @@ def test_public_repo(
124125
fail_value="\n",
125126
)
126127
assert ":arrow_up:" in comment
128+
assert "## Coverage report (my-great-project)" in comment
129+
assert (
130+
"This comment was produced by python-coverage-comment-action (my-great-project)"
131+
in comment
132+
)
127133

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

0 commit comments

Comments
 (0)