10

When running tests in PyCharm 2022.3.2 (Professional Edition) using pytest (6.2.4) and Python 3.9 I get the following result in the PyCharm console window:

D:\cenv\python.exe "D:/Program Files (x86)/JetBrains/PyCharm 2022.3.2/plugins/python/helpers/pycharm/_jb_pytest_runner.py" --path D:\tests\test_k.py Testing started at 6:49 PM ... Launching pytest with arguments D:\tests\test_k.py --no-header --no-summary -q in D:\tests

============================= test session starts ============================= collecting ... collected 5 items

test_k.py::test_init test_k.py::test_1 test_k.py::test_2 test_k.py::test_3 test_k.py::test_4

======================= 5 passed, 278 warnings in 4.50s =======================

Process finished with exit code 0 PASSED [ 20%]PASSED [ 40%]PASSED [ 60%]PASSED [ 80%]PASSED [100%]

So the actual warnings don't show. Only the number of warnings (278) is shown.

I tried:

  1. selecting: Pytest: do not add "--no-header --no-summary -q" in advanced settings

  2. Setting Additional arguments to -Wall in the Run/Debug configurations window

  3. Setting Interpreter options to -Wall in the Run/Debug configurations window

and all permutations, all to no avail. Is there a way to show all runtime warnings when running tests using pytest in PyCharm in the PyCharm Console window?

EDIT:

@Override12

When I select do not add "--no-header --no-summary -q" in advanced settings I get the following output:

D:\Projects\S\SHARK\development_SCE\cenv\python.exe "D:/Program Files (x86)/JetBrains/PyCharm 2020.3.4/plugins/python/helpers/pycharm/_jb_pytest_runner.py" --path D:\Projects\S\SHARK\development_SCE\cenv\Lib\site-packages\vistrails-3.5.0rc0-py3.9.egg\vistrails\packages\SHARK\analysis\tests\test_fairing_1_plus_k.py -- --jb-show-summary Testing started at 10:07 AM ... Launching pytest with arguments D:\Projects\S\SHARK\development_SCE\cenv\Lib\site-packages\vistrails-3.5.0rc0-py3.9.egg\vistrails\packages\SHARK\analysis\tests\test_fairing_1_plus_k.py in D:\Projects\S\SHARK\development_SCE\cenv\Lib\site-packages\vistrails-3.5.0rc0-py3.9.egg\vistrails\packages

============================= test session starts ============================= platform win32 -- Python 3.9.7, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- D:\Projects\S\SHARK\development_SCE\cenv\python.exe cachedir: .pytest_cache rootdir: D:\Projects\S\SHARK\development_SCE\cenv\Lib\site-packages\vistrails-3.5.0rc0-py3.9.egg\vistrails\packages plugins: pytest_check-1.0.5 collecting ... collected 5 items

SHARK/analysis/tests/test_fairing_1_plus_k.py::test_init SHARK/analysis/tests/test_fairing_1_plus_k.py::test_without_1_k_fairing SHARK/analysis/tests/test_fairing_1_plus_k.py::test_1_k_fairing_given SHARK/analysis/tests/test_fairing_1_plus_k.py::test_without_1_k_fairing_only_3_values_under_threshold SHARK/analysis/tests/test_fairing_1_plus_k.py::test_1_k_fairing_given_only_3_values_under_threshold

============================== warnings summary =============================== ......\pyreadline\py3k_compat.py:8 D:\Projects\S\SHARK\development_SCE\cenv\lib\site-packages\pyreadline\py3k_compat.py:8: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working return isinstance(x, collections.Callable)

......\nose\importer.py:12 D:\Projects\S\SHARK\development_SCE\cenv\lib\site-packages\nose\importer.py:12: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses from imp import find_module, load_module, acquire_lock, release_lock

SHARK/analysis/tests/test_fairing_1_plus_k.py: 276 warnings D:\Projects\S\SHARK\development_SCE\cenv\lib\site-packages\pymarin\objects\key.py:1101: UserWarning: siUnits is deprecated, use siUnit warnings.warn('siUnits is deprecated, use siUnit')

-- Docs: https://docs.pytest.org/en/stable/warnings.html ======================= 5 passed, 278 warnings in 5.79s =======================

Process finished with exit code 0 PASSED [ 20%]PASSED [ 40%]PASSED [ 60%]PASSED [ 80%]PASSED [100%]

So 4 warnings are displayed. However I would like to see all 278 warnings.

When I run pytest from the command line outside PyCharm I get the same result. So it seems to be a pytest problem and it seems that it has nothing to do with PyCharm.

2
  • 1
    I'm pretty sure this is due to --no-summary argument added by PyCharm. Can you try checking it again from advanced settings and post the output ? Your current output suggests you still have those arguments appended to your pytest command Commented Feb 11, 2023 at 1:31
  • @ override12 I edited the question with the output of the 'do not add "--no-header --no-summary -q" in advanced settings' case Commented Feb 13, 2023 at 9:25

2 Answers 2

12

The solution is a combination of two things:

  1. Setting 'do not add "--no-header --no-summary -q"' in advanced settings as @Override12 suggested.
  2. When the same warning is issued multiple times, only the first time is displayed. In my case solving the first warning reduced the number of warnings from 278 to 2.
Sign up to request clarification or add additional context in comments.

1 Comment

Useful, but keep in mind that PyCharm will seemingly ignore that setting if you rerun a test from the run panel. Sigh.
0

I think you could also try adding verbosity or collect warnings in a programatic way, by changing how you execute the tests.

1 Comment

I tried verbosity and collect warnings. Unfortunately they both do not change the output. But maybe I am doing it the wrong way?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.