Skip to content

Commit

Permalink
Migrate pytest configurations to pyproject.toml (#725)
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman authored Dec 14, 2020
1 parent e6d45ec commit 6434b55
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies:
- ipython
- matplotlib
- jupyter
- pytest
- pytest>=6.0
- pytest-cov
- pytest-mpl
- coverage[toml]
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ipython
matplotlib
jupyter
pytest
pytest>=6.0
pytest-cov
pytest-mpl
coverage[toml]
Expand Down

0 comments on commit 6434b55

Please sign in to comment.