Skip to content

Commit 6434b55

Browse files
authored
Migrate pytest configurations to pyproject.toml (#725)
1 parent e6d45ec commit 6434b55

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,11 @@ Leave a comment in the PR and we'll help you out.
311311

312312
You can also run tests in just one test script using:
313313

314-
pytest --verbose --mpl --mpl-results-path=results --doctest-modules pygmt/tests/NAME_OF_TEST_FILE.py
314+
pytest pygmt/tests/NAME_OF_TEST_FILE.py
315315

316316
or run tests which contain names that match a specific keyword expression:
317317

318-
pytest --verbose --mpl --mpl-results-path=results --doctest-modules -k KEYWORD pygmt/tests
318+
pytest -k KEYWORD pygmt/tests
319319

320320
### Testing plots
321321

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# Build, package, test, and clean
22
PROJECT=pygmt
33
TESTDIR=tmp-test-dir-with-unique-name
4-
PYTEST_ARGS=--cov=$(PROJECT) --cov-config=../pyproject.toml \
4+
PYTEST_COV_ARGS=--cov=$(PROJECT) --cov-config=../pyproject.toml \
55
--cov-report=term-missing --cov-report=xml --cov-report=html \
6-
--doctest-modules -v --mpl --mpl-results-path=results \
76
--pyargs ${PYTEST_EXTRA}
87
BLACK_FILES=$(PROJECT) setup.py doc/conf.py examples
98
BLACKDOC_OPTIONS=--line-length 79
@@ -30,7 +29,7 @@ test:
3029
@echo ""
3130
@cd $(TESTDIR); python -c "import $(PROJECT); $(PROJECT).show_versions()"
3231
@echo ""
33-
cd $(TESTDIR); pytest $(PYTEST_ARGS) $(PROJECT)
32+
cd $(TESTDIR); pytest $(PYTEST_COV_ARGS) $(PROJECT)
3433
cp $(TESTDIR)/coverage.xml .
3534
cp -r $(TESTDIR)/htmlcov .
3635
rm -r $(TESTDIR)

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies:
1414
- ipython
1515
- matplotlib
1616
- jupyter
17-
- pytest
17+
- pytest>=6.0
1818
- pytest-cov
1919
- pytest-mpl
2020
- coverage[toml]

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
[tool.coverage.run]
22
omit = ["*/tests/*", "*pygmt/__init__.py"]
3+
4+
[tool.pytest.ini_options]
5+
minversion = "6.0"
6+
addopts = "--verbose --doctest-modules --mpl --mpl-results-path=results"

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
ipython
33
matplotlib
44
jupyter
5-
pytest
5+
pytest>=6.0
66
pytest-cov
77
pytest-mpl
88
coverage[toml]

0 commit comments

Comments
 (0)