Skip to content

Switch test suite to pytest and update CI workflow to support pytest#521

Merged
ppizarror merged 6 commits intoppizarror:masterfrom
JaskRendix:tests
Mar 15, 2026
Merged

Switch test suite to pytest and update CI workflow to support pytest#521
ppizarror merged 6 commits intoppizarror:masterfrom
JaskRendix:tests

Conversation

@JaskRendix
Copy link
Collaborator

PR updates the test suite to use pytest. The current CI workflow fails because the reusable workflow runs nose2, which cannot execute pytest tests. The suite uses pytest features such as fixtures, parametrization, and monkeypatch, so nose2 cannot run it. To restore CI compatibility, the reusable workflow needs to support pytest. Possible solutions:

  1. Replace the nose2 command with pytest:

    pytest -vv --cov
    
  2. Add an input to select the test runner:

    test-runner: pytest | nose2
    

    and switch based on that value.

  3. Add an input that allows callers to override the test command.

The test suite passes locally under pytest and requires CI support for pytest to run correctly.

@JaskRendix JaskRendix force-pushed the tests branch 2 times, most recently from 07b1e34 to da50066 Compare March 6, 2026 15:27
@JaskRendix
Copy link
Collaborator Author

@ppizarror quick question about the CI setup.

Right now the repo uses a reusable workflow:
uses: ppizarror/workflow-actions/.github/workflows/test_python.yml@master

Would you prefer:

  • Moving the entire test logic directly into the main CI workflow, so everything lives in one file,
  • Updating the reusable workflow to use pytest instead of nose2, and keeping the current structure?

Just want to align with your preferred direction before I touch anything.

@ppizarror
Copy link
Owner

Hi. I will update the workflow, adding a "test_engine": pytest

@JaskRendix
Copy link
Collaborator Author

@ppizarror ok, let me know when it's ready, eventually you could replace:

if [ "${{ inputs.coverage }}" = "true" ]; then
  nose2 --verbose --with-coverage ${{ inputs.nose-args }}
else
  nose2 --verbose ${{ inputs.nose-args }}
fi

with

if [ "${{ inputs.coverage }}" = "true" ]; then
  pytest --cov=pygame_menu
else
  pytest
fi

@ppizarror
Copy link
Owner

Hi @JaskRendix . I've added a "engine" param, so in this case, workflow should be edited with
... engine: pytest

Followed your guidelines, hope it works: ppizarror/workflow-actions@2577eb7

@JaskRendix
Copy link
Collaborator Author

@ppizarror we need to merge the other PR with the updated pyproject.toml first. Once that’s in, the workflow will pick up the new test extras and everything should work with engine: pytest as expected.

@ppizarror
Copy link
Owner

@ppizarror we need to merge the other PR with the updated pyproject.toml first. Once that’s in, the workflow will pick up the new test extras and everything should work with engine: pytest as expected.

merged. Lets see how that works.

@JaskRendix JaskRendix force-pushed the tests branch 4 times, most recently from e71c546 to b44de2b Compare March 13, 2026 12:51
@JaskRendix JaskRendix marked this pull request as ready for review March 13, 2026 12:56
@JaskRendix
Copy link
Collaborator Author

@ppizarror now everything runs. I bumped into failing tests with a segfault in garbage collection caused by pygame cleanup. Disabling GC during tests and running a manual cleanup after each test fixes the issue.

@ppizarror ppizarror merged commit 9336371 into ppizarror:master Mar 15, 2026
10 checks passed
@JaskRendix JaskRendix deleted the tests branch March 16, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants