Skip to content

Commit

Permalink
Add --expected-failures option
Browse files Browse the repository at this point in the history
Also add corresponding input to the action

Signed-off-by: Jussi Kukkonen <[email protected]>
  • Loading branch information
jku committed Jul 15, 2024
1 parent 3026625 commit 8fd648a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
11 changes: 9 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ description: "TUF client conformance test suite"

inputs:
entrypoint:
description: "client wrapper to invoke"
description: "client-under-test CLI to invoke"
required: true
expected-failures:
description: "Optional list test names expected to fail"
default: ""
required: false

runs:
using: "composite"
Expand All @@ -26,7 +30,10 @@ runs:
id: sigstore-conformance
env:
ENTRYPOINT: ${{ inputs.entrypoint }}
EXPECTED_FAILURES: ${{ inputs.expected-failures }}
TEST_LOCATION: ${{ github.action_path }}/tuf_conformance
run: |
pytest -v "$TEST_LOCATION" --entrypoint "$ENTRYPOINT"
pytest -v "$TEST_LOCATION" \
--entrypoint "$ENTRYPOINT" \
--expected-failures "$EXPECTED_FAILURES"
shell: bash
18 changes: 17 additions & 1 deletion tuf_conformance/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ def pytest_addoption(parser) -> None:
required=True,
type=str,
)
parser.addoption(
"--expected-failures",
action="store",
help="Optional space delimited list of test names expected to fail",
required=False,
type=str,
)


@pytest.fixture
def server():
Expand All @@ -34,4 +42,12 @@ def client(pytestconfig, server):

return ClientRunner(entrypoint, server)



@pytest.fixture(autouse=True)
def conformance_xfail(pytestconfig, request):
xfail_option = pytestconfig.getoption("--expected-failures")
if xfail_option is None:
return

if request.node.originalname in xfail_option.split(" "):
request.node.add_marker(pytest.mark.xfail(strict=True))

0 comments on commit 8fd648a

Please sign in to comment.