Skip to content

Got a warnings count but no warnings anywhere? #969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ionelmc opened this issue Aug 27, 2015 · 6 comments
Closed

Got a warnings count but no warnings anywhere? #969

ionelmc opened this issue Aug 27, 2015 · 6 comments

Comments

@ionelmc
Copy link
Member

ionelmc commented Aug 27, 2015

At the end I get something like 50 passed, 2 warnings in 24.72 seconds.

Full output:

GLOB sdist-make: /home/ionel/osp/pytest-cov/setup.py
2.7-28-40 inst-nodeps: /home/ionel/osp/pytest-cov/.tox/dist/pytest-cov-2.1.0.zip
2.7-28-40 installed: -f file:///home/ionel/.pip/wheels,apipkg==1.4,coverage==4.0b2,execnet==1.4.0,pluggy==0.3.0,process-tests==1.0.0,py==1.4.30,pytest==2.7.3.dev376+ng06b1b69,pytest-capturelog==0.7,pytest-cov==2.1.0,pytest-xdist==1.13.1,virtualenv==13.1.2,wheel==0.24.0
2.7-28-40 runtests: PYTHONHASHSEED='4222968122'
2.7-28-40 runtests: commands[0] | py.test
============================================================================================================ test session starts ============================================================================================================
platform linux2 -- Python 2.7.3, pytest-2.7.3.dev376+ng06b1b69, py-1.4.30, pluggy-0.3.0
rootdir: /home/ionel/osp/pytest-cov, inifile: setup.cfg
plugins: xdist-1.13.1, capturelog-0.7, cov-2.1.0
collected 50 items

AUTHORS.rst .
CHANGELOG.rst .
CONTRIBUTING.rst .
README.rst .
docs/authors.rst .
docs/changelog.rst .
docs/contributing.rst .
docs/index.rst .
docs/installation.rst .
docs/readme.rst .
docs/releasing.rst .
tests/test_pytest_cov.py .......................................

================================================================================================== 50 passed, 2 warnings in 24.72 seconds ===================================================================================================
__________________________________________________________________________________________________________________ summary __________________________________________________________________________________________________________________
  2.7-28-40: commands succeeded
  congratulations :)

Are these python warnings (as in the warnings module)? They would be hidden by the capture plugin but maybe there should be an easy way to see them?

@nicoddemus
Copy link
Member

Those warnings are generated by the internal warnings mechanism introduced in 2.6. To show them you have to pass -rw in the command-line.

I agree that perhaps this could be tweaked thought:

  1. Perhaps rename "warnings" to something else to distinguish from warnings from the warnings module? pytest-warnings?

    === 50 passed, 2 pytest-warnings in 24.72 seconds ===
    
  2. Always show warnings by default? Not sure.

@ionelmc
Copy link
Member Author

ionelmc commented Aug 27, 2015

Ok, now I realize I didn't read the docs enough 😁

Would there be any situation where you don't want to see warnings?

@nicoddemus
Copy link
Member

One of the warnings for example is "class starts with Test but has init declared" (or something like this), so that class will not be collected as a test... there might be valid reasons for that, that's why it is a warning.

Personally I like to always see warnings (as if -rw were passed), but perhaps seeing "X pytest-warnings" is enough to prompt people to take a look and perhaps fix issues, if any.

Oh I just realized the recent record_xml_property fixture also emits warnings about it being experimental. Because this is a valid feature, perhaps always display warnings might not be a good solution over all.

Any other opinions?

@ionelmc
Copy link
Member Author

ionelmc commented Aug 27, 2015

I'm fine with closing this, it was largely my misunderstanding.

@nicoddemus
Copy link
Member

Renaming warnings in the terminal to pytest-warnings is starting to sit well with me... I recall one or two occasions where colleagues thought that some warnings were being emitted by the warnings module when they saw that.

@nicoddemus
Copy link
Member

Opened #970 to start a discussion on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants