An autohooks plugin for python code testing via pytest.
You can install the latest stable release of autohooks-plugin-pytest from the Python Package Index using pip:
pip install autohooks-plugin-pytest
Note the pip
refers to the Python 3 package manager. In a environment where
Python 2 is also available the correct command may be pip3
.
It is highly encouraged to use pipenv for maintaining your project's dependencies. Normally autohooks-plugin-pytest is installed as a development dependency.
pipenv install --dev autohooks-plugin-pytest
To activate the pytest autohooks plugin please add the following setting to your
pyproject.toml
file.
[tool.autohooks]
pre-commit = ["autohooks.plugins.pytest"]
To pass options to pytest
, you have to add an additional
[tool.autohooks.plugins.pytest]
option = "value"
block to your pyproject.toml
file. Possible options are explained in the following.
-
By default, autohooks plugin pytest checks all files with a "test_*.py" inside tests directory . To update root directory just add the following setting:
root_dir = "api_test"
-
You can update the pytest
cli
view mode. some modes are :- quite
"-q"
- non-verbose
"-rf"
view_mode = "-q"
default mode
"-v"
verbose. - quite
-
You have to update the coverage directory :
cov_source = "src"
default direcotry is
"src"
. -
You can update the coverage on pytest fail :
cov_on_fail = false
default value is
true
. -
You can update the coverage :
cov_under_fail = 80
default percentage is
100
. -
You can update the coverage report format :
cov_report_format = "html"
default report format is
"xml"
.
Your contributions are highly appreciated. Please create a pull request on GitHub. Bigger changes need to be discussed with the development team via the issues section at GitHub first.
Licensed under the GNU General Public License v3.0 or later.