showcapture in pytest.ini ignored in 5.4.2
See original GitHub issueI added showcapture=stdout
to my pytest.ini
, however, I still get the log capture section
[pytest]
log_date_format=%H:%M:%S
log_cli_format=%(asctime)s,%(msecs)03.0f [%(name)-5s:%(lineno)-4d][%(levelname)-8s][%(processName)s(%(process)s)] %(message)s
log_file_format=%(asctime)s,%(msecs)03d [%(name)-17s:%(lineno)-4d][%(levelname)-8s][%(processName)s(%(process)d)] %(message)s
norecursedirs=templates tests/kitchen tests/utils tests/support
testpaths=tests
python_files=test_*.py
python_classes=Test*
python_functions = test_*
junit_family=xunit2
showcapture=stdout
❯ nox -e 'pytest-zeromq-3.5(coverage=False)' -- --log-cli-level=info -svv --maxfail=1 --run-slow --run-destructive tests/unit/test_config.py -k foo
nox > Running session pytest-zeromq-3.5(coverage=False)
nox > Re-using existing virtualenv at .nox/pytest-zeromq-3-5-coverage-false.
nox > Session pytest-zeromq-3.5(coverage=False) was successful.
nox > Running session pytest-parametrized-3.5(coverage=False, crypto=None, transport='zeromq')
nox > Re-using existing virtualenv at .nox/pytest-parametrized-3-5-coverage-false-crypto-none-transport-zeromq.
nox > pip install --progress-bar=off -r requirements/static/py3.5/linux.txt
nox > pip uninstall -y pytest-salt
nox > python -m pytest --rootdir /home/vampas/projects/SaltStack/salt/pytest/1 --log-file=artifacts/logs/runtests-20200522112843.654261.log --log-fil
e-level=debug -ra -s --transport=zeromq --log-cli-level=info -svv --maxfail=1 --run-slow --run-destructive tests/unit/test_config.py -k foo
[ ADDITIONAL OUTPUT]
----------------------------------------------------------------- Captured log call -----------------------------------------------------------------
WARNING tests.unit.test_config:test_config.py:82 Foo
If however I pass --show-capture=stdout
on the CLI, it works as expected
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
How to capture stdout/stderr output
During test execution any output sent to stdout and stderr is captured. If a test or a setup method fails its according captured...
Read more >pytest Documentation
You can register custom marks in your pytest.ini file like this: ... For example, to make pytest ignore trailing whitespaces and ignore ......
Read more >Pytest ignores pytest.ini file
The import works for me but pytest ignores the django settings defined in the pytest.ini file. It also ignores the "TEST' key defined...
Read more >pytest Changelog
stopgap measure by adding this to your ``pytest.ini`` file: .. code-block:: ini [pytest] filterwarnings = ignore::pytest.PytestRemovedIn7Warning
Read more >pytest Documentation
The same option can be set in the pytest.ini file using the filterwarnings ini option. For example, the configu- ration below will ignore...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For anyone else finding this, the
pytest.ini
option should have a dash betweenshow
andcapture
:I wasn’t using it in 4.x. I started with 5.x because of the
--no-print-logs
deprecation, and now that you mention it, I think I was assuming there would be a ini config as well. I guess this issue can be closed as invalid.