jossmoff/bookshelf

✨ Add mutation tests

Closed this issue · 0 comments

Search before asking

  • I have searched in the issues and found no similar issues.

Description

We can use mutmut to set up running mutation tests. We can run in the pipeline and set a threshold for an allowable mutation amount.

Solution

Could use a workflow similar to below to run mutation tests when a certain label is added:

name: Mutation Testing Workflow

on:
  pull_request:
    types:
      - labeled

jobs:
  mutation-tests:
    if: contains(github.event.pull_request.labels.*.name, 'mutation tests')
    runs-on: ubuntu-latest

    steps:
    - name: 🔄 Checkout code
      uses: actions/checkout@v2

    - name: 🐍 Set up Python
      uses: actions/setup-python@v2
      with:
        python-version: 3.x  # Specify your desired Python version

    - name: 📦 Install dependencies
      run: pip install -r requirements-dev.txt  # Replace with your requirements file

    - name: ❄️ Run Flake8
      run: flake8 .

    - name: 🦠 Run unit tests
      run: mutmut run --CI

Are you willing to submit PR?

  • Yes I am willing to submit a PR!