Skip to content
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

pytest 3.4 breaks test with CherryPy - no attribute 'testscollected' & I/O operation on closed file #3174

Closed
4 tasks
pawciobiel opened this issue Jan 31, 2018 · 5 comments
Labels
status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity

Comments

@pawciobiel
Copy link

pawciobiel commented Jan 31, 2018

So my test suite works fine with pytest 3.3.2 but fails with errors in pytest 3.4

  • Include a detailed description of the bug or suggestion
    INTERNALERROR> Traceback (most recent call last):
    INTERNALERROR> File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/_pytest/main.py", line 100, in wrap_session
    INTERNALERROR> session.exitstatus = doit(config, session) or 0
    INTERNALERROR> File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/_pytest/main.py", line 138, in _main
    INTERNALERROR> config.hook.pytest_runtestloop(session=session)
    INTERNALERROR> File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/init.py", line 617, in call
    INTERNALERROR> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
    INTERNALERROR> File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/init.py", line 222, in _hookexec
    INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
    INTERNALERROR> File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/init.py", line 216, in
    INTERNALERROR> firstresult=hook.spec_opts.get('firstresult'),
    INTERNALERROR> File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/callers.py", line 201, in _multicall
    INTERNALERROR> return outcome.get_result()
    INTERNALERROR> File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/callers.py", line 76, in get_result
    INTERNALERROR> raise ex[1].with_traceback(ex[2])
    INTERNALERROR> File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/callers.py", line 180, in _multicall
    INTERNALERROR> res = hook_impl.function(*args)
    INTERNALERROR> File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/_pytest/main.py", line 161, in pytest_runtestloop
    INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
    INTERNALERROR> File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/init.py", line 617, in call
    INTERNALERROR> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
    INTERNALERROR> File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/init.py", line 222, in _hookexec
    INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
    INTERNALERROR> File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/init.py", line 216, in
    INTERNALERROR> firstresult=hook.spec_opts.get('firstresult'),
    INTERNALERROR> File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/callers.py", line 201, in _multicall
    INTERNALERROR> return outcome.get_result()
    INTERNALERROR> File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/callers.py", line 76, in get_result
    INTERNALERROR> raise ex[1].with_traceback(ex[2])
    INTERNALERROR> File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/callers.py", line 180, in _multicall
    INTERNALERROR> res = hook_impl.function(*args)
    INTERNALERROR> File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/_pytest/runner.py", line 64, in pytest_runtest_protocol
    INTERNALERROR> nodeid=item.nodeid, location=item.location,
    INTERNALERROR> File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/init.py", line 617, in call
    INTERNALERROR> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
    INTERNALERROR> File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/init.py", line 222, in _hookexec
    INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
    INTERNALERROR> File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/init.py", line 216, in
    INTERNALERROR> firstresult=hook.spec_opts.get('firstresult'),
    INTERNALERROR> File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/callers.py", line 201, in _multicall
    INTERNALERROR> return outcome.get_result()
    INTERNALERROR> File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/callers.py", line 76, in get_result
    INTERNALERROR> raise ex[1].with_traceback(ex[2])
    INTERNALERROR> File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/callers.py", line 180, in _multicall
    INTERNALERROR> res = hook_impl.function(*args)
    INTERNALERROR> File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/_pytest/terminal.py", line 315, in pytest_runtest_logfinish
    INTERNALERROR> last_item = len(self._progress_nodeids_reported) == self._session.testscollected
    INTERNALERROR> AttributeError: 'NoneType' object has no attribute 'testscollected'

Traceback (most recent call last):
File "/usr/lib/python3.6/logging/init.py", line 994, in emit
stream.write(msg)
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/_pytest/capture.py", line 337, in write
self.buffer.write(obj)
ValueError: I/O operation on closed file
Call stack:
File "/home/pgb/venvs/py36_air/bin/pytest", line 11, in
sys.exit(main())
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/_pytest/config.py", line 59, in main
return config.hook.pytest_cmdline_main(config=config)
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/init.py", line 617, in call
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/init.py", line 222, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/init.py", line 216, in
firstresult=hook.spec_opts.get('firstresult'),
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/callers.py", line 180, in _multicall
res = hook_impl.function(*args)
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/_pytest/main.py", line 131, in pytest_cmdline_main
return wrap_session(config, _main)
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/_pytest/main.py", line 125, in wrap_session
exitstatus=session.exitstatus)
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/init.py", line 617, in call
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/init.py", line 222, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/init.py", line 216, in
firstresult=hook.spec_opts.get('firstresult'),
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/pluggy/callers.py", line 180, in _multicall
res = hook_impl.function(*args)
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/_pytest/runner.py", line 55, in pytest_sessionfinish
session._setupstate.teardown_all()
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/_pytest/runner.py", line 468, in teardown_all
self._pop_and_teardown()
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/_pytest/runner.py", line 441, in _pop_and_teardown
self._teardown_with_finalization(colitem)
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/_pytest/runner.py", line 459, in _teardown_with_finalization
self._callfinalizers(colitem)
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/_pytest/runner.py", line 449, in _callfinalizers
fin()
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/_pytest/fixtures.py", line 742, in finish
func()
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/cherrypy/process/wspbus.py", line 262, in exit
self.stop()
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/cherrypy/process/wspbus.py", line 416, in stop
self.log('Bus STOPPING')
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/cherrypy/process/wspbus.py", line 444, in log
self.publish('log', msg, level)
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/cherrypy/process/wspbus.py", line 203, in publish
output.append(listener(*args, **kwargs))
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/cherrypy/init.py", line 354, in _buslog
log.error(msg, 'ENGINE', severity=level)
File "/home/pgb/venvs/py36_air/lib/python3.6/site-packages/cherrypy/_cplogging.py", line 216, in error
self.error_log.log(severity, ' '.join((self.time(), context, msg)), exc_info=exc_info)
Message: '[31/Jan/2018:12:38:00] ENGINE Bus STOPPING'
Arguments: ()

  • pip list of the virtual environment you are using
    I had to remove some packages from the list bellow:
    attrs (17.4.0)
    backports.functools-lru-cache (1.4)
    backports.unittest-mock (1.3)
    boto (2.48.0)
    certifi (2018.1.18)
    chardet (3.0.4)
    check-manifest (0.36)
    CherryPy (5.6.0)
    decorator (4.2.1)
    devpi-client (4.0.0)
    devpi-common (3.2.1)
    idna (2.6)
    inflect (0.2.5)
    ipython (6.2.1)
    ipython-genutils (0.2.0)
    jedi (0.11.1)
    more-itertools (4.1.0)
    newrelic (2.100.0.84)
    parso (0.1.1)
    path.py (10.5)
    pexpect (4.3.1)
    pickleshare (0.7.4)
    Pillow (5.0.0)
    pip (9.0.1)
    pkginfo (1.4.1)
    pluggy (0.6.0)
    portend (2.2)
    prompt-toolkit (1.0.15)
    ptyprocess (0.5.2)
    py (1.5.2)
    pyasn1 (0.4.2)
    Pygments (2.2.0)
    pymongo (3.6.0)
    pytest (3.3.2)
    pytest-ordering (0.5)
    pytest-sugar (0.9.0)
    python-dateutil (2.6.1)
    pytimeparse (1.1.7)
    pytz (2017.3)
    PyYAML (3.12)
    repoze.lru (0.7)
    requests (2.18.4)
    Routes (2.4.1)
    rsa (3.4.2)
    setuptools (38.4.0)
    simplegeneric (0.8.1)
    six (1.11.0)
    tempora (1.10)
    termcolor (1.1.0)
    tox (2.9.1)
    traitlets (4.3.2)
    urllib3 (1.22)
    virtualenv (15.1.0)
    wcwidth (0.1.7)
    wheel (0.30.0)
    zc.lockfile (1.2.1)
    zencoder (0.6.5)

  • pytest and operating system versions
    Ubuntu 17.10
    Python 3.6.3
    plugins: sugar-0.9.0, ordering-0.5, jaraco.mongodb-7.3.1, backports.unittest-mock-1.3

  • Minimal example if possible
    I'll try to write a few lines that I can share which will reproduce it when I have a moment - or when asked.

@pytestbot pytestbot added plugin: logging related to the logging builtin plugin type: bug problem that needs to be addressed labels Jan 31, 2018
@nicoddemus
Copy link
Member

At least the first problem seems to be a duplicate of #3170, this is an incompatibility between pytest and pytest-sugar.

@nicoddemus nicoddemus added status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity and removed plugin: logging related to the logging builtin plugin type: bug problem that needs to be addressed labels Jan 31, 2018
@pawciobiel
Copy link
Author

thanks

@nicoddemus
Copy link
Member

Can you post some reproducible example about the other issue?

@pawciobiel
Copy link
Author

No because after removing pytest-sugar it doesn't appear anymore.
Thanks for help on this.

@nicoddemus
Copy link
Member

FYI pytest-sugar released a new version yesterday fixing the compability issue, you might want to try it out. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity
Projects
None yet
Development

No branches or pull requests

3 participants