diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e692e0af6e9..a6ebc260e97 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -311,11 +311,11 @@ Leave a comment in the PR and we'll help you out. You can also run tests in just one test script using: - pytest --verbose --mpl --mpl-results-path=results --doctest-modules pygmt/tests/NAME_OF_TEST_FILE.py + pytest pygmt/tests/NAME_OF_TEST_FILE.py or run tests which contain names that match a specific keyword expression: - pytest --verbose --mpl --mpl-results-path=results --doctest-modules -k KEYWORD pygmt/tests + pytest -k KEYWORD pygmt/tests ### Testing plots diff --git a/Makefile b/Makefile index 54fa7d9dccd..2c6c52904dc 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,8 @@ # Build, package, test, and clean PROJECT=pygmt TESTDIR=tmp-test-dir-with-unique-name -PYTEST_ARGS=--cov=$(PROJECT) --cov-config=../pyproject.toml \ +PYTEST_COV_ARGS=--cov=$(PROJECT) --cov-config=../pyproject.toml \ --cov-report=term-missing --cov-report=xml --cov-report=html \ - --doctest-modules -v --mpl --mpl-results-path=results \ --pyargs ${PYTEST_EXTRA} BLACK_FILES=$(PROJECT) setup.py doc/conf.py examples BLACKDOC_OPTIONS=--line-length 79 @@ -30,7 +29,7 @@ test: @echo "" @cd $(TESTDIR); python -c "import $(PROJECT); $(PROJECT).show_versions()" @echo "" - cd $(TESTDIR); pytest $(PYTEST_ARGS) $(PROJECT) + cd $(TESTDIR); pytest $(PYTEST_COV_ARGS) $(PROJECT) cp $(TESTDIR)/coverage.xml . cp -r $(TESTDIR)/htmlcov . rm -r $(TESTDIR) diff --git a/environment.yml b/environment.yml index fec3dbaaebf..29b8a26c61b 100644 --- a/environment.yml +++ b/environment.yml @@ -14,7 +14,7 @@ dependencies: - ipython - matplotlib - jupyter - - pytest + - pytest>=6.0 - pytest-cov - pytest-mpl - coverage[toml] diff --git a/pyproject.toml b/pyproject.toml index a89cdc51b53..4ccfb80a8d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,2 +1,6 @@ [tool.coverage.run] omit = ["*/tests/*", "*pygmt/__init__.py"] + +[tool.pytest.ini_options] +minversion = "6.0" +addopts = "--verbose --doctest-modules --mpl --mpl-results-path=results" diff --git a/requirements-dev.txt b/requirements-dev.txt index fc05772b072..129df8f4475 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -2,7 +2,7 @@ ipython matplotlib jupyter -pytest +pytest>=6.0 pytest-cov pytest-mpl coverage[toml]