question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

showcapture in pytest.ini ignored in 5.4.2

See original GitHub issue

I 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:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
mshrivercommented, Feb 19, 2021

For anyone else finding this, the pytest.ini option should have a dash between show and capture:

addopts = --show-capture=<value>
2reactions
s0undt3chcommented, May 22, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found