Up top, thanks for considering a contribution! New features that align to the vision are welcome. You can either open an issue to discuss the idea first, or if you have working code, submit a pull-request.
The goal of mutatest
is to provide a simple tool and API for mutation testing.
The top level priorities for the project are:
- Collect useful mutation patterns without modifying the target source code.
- Make it fast.
Open questions I'm working through on the design:
- Fancy test selection? If there is a way to not only test coverage, but only select tests based on the mutation location (a form of "who tests what") that could make trials more efficient.
- Local database? Keeping a local database of mutations and trial results would allow for re-running failed mutations quickly. Providing the ability to log false positives to skip on future samples would also be valuable.
- Clustered mutations? There could be room for specifying a number of mutations to run simultaneously.
- More API options? If you add two Genomes together should it create a GenomeGroup automatically?
- More reporting options? HTML etc.
The following guidelines are used in the style formatting of this package. Many are enforced through
pre-commit
Git hooks and in the test running configuration of tox
.
Here is how to get up and running for development on mutatest
. Referenced tools are included
in the development dependencies as part of the set up procedure.
- Fork this repo, then clone your fork locally.
- Create a new Python virtual environment using Python 3.7 and activate it.
- Change to the local directory of your clone. All commands are run in the top level directory
where the
setup.py
file is located. - Install
mutatest
in edit mode with all development dependencies usingpip
.
$ pip install -e .[dev]
- Run a clean
tox
trial to ensure you're starting from a correct installation:
$ tox
# expected output ...
py37: commands succeeded
lint: commands succeeded
typing: commands succeeded
pypi-description: commands succeeded
manifest: commands succeeded
help: commands succeeded
congratulations :)
- Install
pre-commit
for the cloned repo. This ensures that every commit runs the formatting checks includingblack
andflake8
.
$ pre-commit install
- Start developing!
- Run
tox
one more time before you open the PR to make sure your functionality passes the original tests (and any new ones you have added).
- Generally hard-wrap at 100 characters for all files, including text files or RST.
- Prefer RST over markdown or plaintext for explanations and outputs.
- Accept the edits from the
pre-commit
configuration e.g. to trim trailing whitespace.
Many of these points are automated with pre-commit
and the existing configuration settings
for black
and flake8
. In general:
- Use
isort
for orderingimport
statements in Python files.- Run
black
for formatting all Python files.- Use "Google Style" doc-string formatting for functions.
- Type-hints are strictly enforced with
mypy --strct
.- Adhere to PEP-8 for naming conventions and general style defaults.
- All code is hard-wrapped at 100 characters.
- If you are adding a new development tool instead of a feature, prefix the module name with an underscore.
- Provide justification for any new install requirements.
- All tests are stored in the
tests/
directory.- Accept the edits from the
pre-commit
configuration.
Pytest
is used to manage unit tests, and tox
is used to run various environment
tests. Hypothesis
is used for property testing in addition to the unit tests.
If you are adding a new feature ensure that tests are added to cover the functionality.
Some style enforcing is relaxed on the test files:
- Use
isort
for orderingimport
statements in Python files.- Run
black
for formatting all Python files.- Use "Google Style" doc-string formatting for functions, though single-line descriptions can be appropriate for unit test descriptions.
- Test files are all in the
mutatest/tests/
directory so tests are distributed with the package.- Tests do not require type-hints for the core test function or fixtures. Use as appropriate to add clarity with custom classes or mocking.
- Prefer to use
pytest
fixtures such astmp_path
andmonkeypatch
.- All test files are prefixed with
test_
.- All test functions are prefixed with
test_
and are descriptive.- Shared fixtures are stored in
tests/conftest.py
.- Accept the edits from the
pre-commit
configuration.
- Use descriptive commit messages in "action form". Messages should be read as, "If applied, this commit will... <<your commit message>>" e.g. "add tests for coverage of bool_op visit".
- Squash commits as appropriate.