AFM-SPM / TopoStats

An AFM image analysis program to batch process data and obtain statistics from images
https://afm-spm.github.io/TopoStats/
GNU Lesser General Public License v3.0
60 stars 11 forks source link

Run tests with `pre-commit` on only the changed/affected files using pytest-testmon. #923

Closed ns-rse closed 1 month ago

ns-rse commented 1 month ago

We should add a local job to .pre-commit-config.yaml to run pytest on only the files that have been changed or affected by changes using pytest-testmon.

.pre-commit-config.yaml

  - repo: local
    hooks:
      - id: pytest-testmon
        args: ["--rcfile=.pylintrc"]
        name: Pytest Monitor
        entry: pytest 
        language: system
        files: \.py$

pyproject.toml

Add pytest-testmon to the tests optional dependencies.

[project.optional-dependencies]
tests = [
  "pytest",
  "pytest-cov",
  "pytest-github-actions-annotate-failures",
  "pytest-mpl",
  "pytest-regtest",
  "pytest-testmon",
  "filetype",
]

docs/contributing.md

Detail in the docs/contributing.md how to setup and use the pytest-testmon database on initially cloning the repository.

.gitignore

Will probably have to ignore the .testdatamon from version control as it will be dependent on an individuals development stage.