Skip to content

Commit

Permalink
Add mutmut to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
WillGibson committed Nov 20, 2024
1 parent c78d744 commit a6a462f
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 15 deletions.
42 changes: 36 additions & 6 deletions .github/workflows/python-mutation-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ on:
# Todo; remove the push, they take to long
push:
branches:
- add-mutation-testing-with-cosmic-ray
- add-mutation-testing

jobs:
tests:
name: Python mutation tests
cosmic-ray:
name: Python mutation tests - Cosmic Ray
runs-on: ubuntu-latest

strategy:
Expand All @@ -37,7 +37,6 @@ jobs:
- name: Run mutation tests
run: |
# Todo: Can we make it faster in GitHub Actions
# Todo: Drop the --force, it just here for easy local copy and paste
poetry run cosmic-ray init setup.cfg cosmic-ray.sqlite --force
echo "Initialised"
Expand All @@ -46,5 +45,36 @@ jobs:
- name: Report results
# Todo: Only show failures https://github.com/sixty-north/cosmic-ray/issues/561
run: poetry run cr-report cosmic-ray.sqlite --show-diff
env:
PYTHON_VERSION: ${{ matrix.python-version }}

mutmut:
name: Python mutation tests - mutmut
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: ["3.12"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Display Python version
run: python --version

- name: Install dependencies
run: |
pip install poetry
poetry install
- name: Run mutation tests
run: |
poetry run mutmut run
- name: Report results
# Todo: Only show failures https://github.com/sixty-north/cosmic-ray/issues/561
run: poetry run mutmut results
4 changes: 2 additions & 2 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[pytest]
env =
AWS_DEFAULT_REGION=eu-west-2
addopts = --tb=short --numprocesses auto --dist loadgroup
; addopts = --tb=short --numprocesses auto --dist loadgroup
; You may need to use the addopts setting below to unbreak debugging in your IDE
; addopts = --tb=short
addopts = --tb=short

filterwarnings =
ignore::UserWarning:moto.cloudformation.parsing.*
Expand Down
18 changes: 11 additions & 7 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
[cosmic-ray]
module-path = "utils"
module-path = utils
timeout = 10.0
excluded-modules = ["**/node_modules/**/*"]
test-command = "poetry run pytest tests/utils"
test-command = poetry run pytest tests/utils

[cosmic-ray.distributor]
name = "local"
; name = "http"

[cosmic-ray.distributor.http]
worker-urls = ["http://localhost:9876","http://localhost:9877","http://localhost:9878","http://localhost:9879"]
worker-urls =
http://localhost:9876
http://localhost:9877
http://localhost:9878
http://localhost:9879

[mutmut]
paths_to_mutate = "utils/"
runner="poetry run pytest tests/utils"
tests_dir = "tests/utils"
paths_to_mutate = utils
runner= poetry run pytest tests/utils
tests_dir = tests/utils
also_copy=
"dbt_platform_helper"
dbt_platform_helper

0 comments on commit a6a462f

Please sign in to comment.