Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 75cf540

Browse files
committed
Keep sugar for local use, but use instafail on CI
There are two benefits of the pytest-sugar plugin: 1. Pretty output. 2. Show details on each failure immediately instead of at the end. The first benefit is effectively local-only, because extra newlines are appearing when it runs on CI, both with and without -v. The second benefit applies both locally and on CI. So this adds the pytest-instafail plugin and uses it on CI to get the second benefit. It is not set up to run automatically, and pytest-sugar still is (though no longer forced), so local testing retains no benefit and we don't have a clash. The name "instafail" refers only to instantly *seeing* failures: it does not cause the pytest runner to stop earlier than otherwise.
1 parent 680d795 commit 75cf540

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

.github/workflows/cygwin-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ jobs:
6464
- name: Test with pytest
6565
run: |
6666
set +x
67-
/usr/bin/python -m pytest -v
67+
/usr/bin/python -m pytest -p no:sugar -v --instafail

.github/workflows/pythonpackage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878

7979
- name: Test with pytest
8080
run: |
81-
pytest -v
81+
pytest -v -p no:sugar --instafail
8282
continue-on-error: false
8383

8484
- name: Documentation

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
55
[tool.pytest.ini_options]
66
python_files = 'test_*.py'
77
testpaths = 'test' # space separated list of paths from root e.g test tests doc/testing
8-
addopts = '--cov=git --cov-report=term --force-sugar --disable-warnings'
8+
addopts = '--cov=git --cov-report=term --disable-warnings'
99
filterwarnings = 'ignore::DeprecationWarning'
1010
# --cov coverage
1111
# --cov-report term # send report to terminal term-missing -> terminal with line numbers html xml

test-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ mypy
55
pre-commit
66
pytest
77
pytest-cov
8+
pytest-instafail
89
pytest-sugar

0 commit comments

Comments
 (0)