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.

Test suite needs to be updated for py.test 3.x

See original GitHub issue

At the moment, our test suite fails if using pytest 3.x. Of course, we’re not seeing that in the CI because we use the (old) bundled version of pytest 3.x, so this isn’t too urgent. But to see the failures, you can do:

python setup.py build_ext --inplace
py.test astropy

which gives:

========================================================== ERRORS ===========================================================
_____________________________________________________ ERROR collecting  _____________________________________________________
/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/_pytest/main.py:570: in gethookproxy
    return self._fs2hookproxy[fspath]
E   KeyError: local('/Users/tom/Dropbox/Code/Astropy/astropy/astropy/table/tests')

During handling of the above exception, another exception occurred:
/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/_pytest/config.py:301: in _getconftestmodules
    return self._path2confmods[path]
E   KeyError: local('/Users/tom/Dropbox/Code/Astropy/astropy/astropy/table/tests')

During handling of the above exception, another exception occurred:
/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/_pytest/config.py:332: in _importconftest
    return self._conftestpath2mod[conftestpath]
E   KeyError: local('/Users/tom/Dropbox/Code/Astropy/astropy/astropy/table/tests/conftest.py')

During handling of the above exception, another exception occurred:
/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/_pytest/config.py:338: in _importconftest
    mod = conftestpath.pyimport()
/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/py/_path/local.py:650: in pyimport
    __import__(modname)
astropy/table/__init__.py:28: in <module>
    from .column import Column, MaskedColumn
astropy/table/column.py:15: in <module>
    from ..utils.console import color_print
astropy/utils/console.py:29: in <module>
    from IPython import get_ipython
/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/IPython/__init__.py:48: in <module>
    from .core.application import Application
/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/IPython/core/application.py:25: in <module>
    from IPython.core.profiledir import ProfileDir, ProfileDirError
/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/IPython/core/profiledir.py:29: in <module>
    class ProfileDir(LoggingConfigurable):
/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/IPython/core/profiledir.py:52: in ProfileDir
    `profile` option.""",
/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/traitlets/traitlets.py:421: in __init__
    DeprecationWarning, stacklevel=stacklevel)
E   DeprecationWarning: metadata {'config': True} was set from the constructor.  Metadata should be set using the .tag() method, e.g., Int().tag(key1='value1', key2='value2')

During handling of the above exception, another exception occurred:
/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/py/_path/common.py:332: in visit
    for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/py/_path/common.py:378: in gen
    for p in self.gen(subdir):
/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/py/_path/common.py:367: in gen
    dirs = self.optsort([p for p in entries
/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/py/_path/common.py:368: in <listcomp>
    if p.check(dir=1) and (rec is None or rec(p))])
/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/_pytest/main.py:672: in _recurse
    ihook = self.gethookproxy(path)
/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/_pytest/main.py:575: in gethookproxy
    my_conftestmodules = pm._getconftestmodules(fspath)
/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/_pytest/config.py:315: in _getconftestmodules
    mod = self._importconftest(conftestpath)
/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/_pytest/config.py:340: in _importconftest
    raise ConftestImportFailure(conftestpath, sys.exc_info())
E   _pytest.config.ConftestImportFailure: DeprecationWarning("metadata {'config': True} was set from the constructor.  Metadata should be set using the .tag() method, e.g., Int().tag(key1='value1', key2='value2')",)
E     File "/Users/tom/Dropbox/Code/Astropy/astropy/astropy/table/__init__.py", line 28, in <module>
E       from .column import Column, MaskedColumn
E     File "/Users/tom/Dropbox/Code/Astropy/astropy/astropy/table/column.py", line 15, in <module>
E       from ..utils.console import color_print
E     File "/Users/tom/Dropbox/Code/Astropy/astropy/astropy/utils/console.py", line 29, in <module>
E       from IPython import get_ipython
E     File "/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/IPython/__init__.py", line 48, in <module>
E       from .core.application import Application
E     File "/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/IPython/core/application.py", line 25, in <module>
E       from IPython.core.profiledir import ProfileDir, ProfileDirError
E     File "/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/IPython/core/profiledir.py", line 29, in <module>
E       class ProfileDir(LoggingConfigurable):
E     File "/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/IPython/core/profiledir.py", line 52, in ProfileDir
E       `profile` option.""",
E     File "/Users/tom/miniconda3/envs/dev35/lib/python3.5/site-packages/traitlets/traitlets.py", line 421, in __init__
E       DeprecationWarning, stacklevel=stacklevel)
================================================== pytest-warning summary ===================================================
WC1 None [pytest] section in setup.cfg files is deprecated, use [tool:pytest] instead.
WC1 None pytest_funcarg__cov: declaring fixtures using "pytest_funcarg__" prefix is deprecated and scheduled to be removed in pytest 4.0.  Please remove the prefix and use the @pytest.fixture decorator instead.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================== 2 pytest-warnings, 1 error in 3.93 seconds =========================================

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:16 (16 by maintainers)

github_iconTop GitHub Comments

2reactions
astrofrogcommented, Jan 10, 2017

@pllim - you can run pytest with the -s option to see the output of print statements.

0reactions
bsipoczcommented, Aug 3, 2017

We’re on it. Long story short it’s not yet clear whether it’s a bug in our plugin or in pytest so we need to limit the version number of pytest for now, I’m waiting for the builds to pass on ci-helpers (https://github.com/astropy/ci-helpers/pull/222).

https://github.com/pytest-dev/pytest/pull/2651

Read more comments on GitHub >

github_iconTop Results From Across the Web

Full pytest documentation
Install pytest · Create your first test · Run multiple tests · Assert that a certain exception is raised · Group multiple tests...
Read more >
Automationeers Assemble: Customizing your pytest test suite
Raphael will provide an introduction into automated testing in Python with pytest, a popular testing framework developed and maintained by a ...
Read more >
Effective Python Testing With Pytest
In this tutorial, you'll learn how to take your testing to the next level with pytest. You'll cover intermediate and advanced pytest ......
Read more >
Testing Python Applications with Pytest - Semaphore Tutorial
This tutorial will demonstrate how to write tests for Python code with pytest, and how to utilize it to cater for a wide...
Read more >
Customizing your pytest test suite (part 1) - Raphael Pierzina
Our task. We will work on identifying blind spots in the earth project and increasing its code coverage by developing a series of...
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