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

Test collecting errors with pytest 3.2.0 #6418

Closed
bsipocz opened this issue Aug 2, 2017 · 32 comments · Fixed by #6419
Closed

Test collecting errors with pytest 3.2.0 #6418

bsipocz opened this issue Aug 2, 2017 · 32 comments · Fixed by #6419
Labels
Milestone

Comments

@bsipocz
Copy link
Member

bsipocz commented Aug 2, 2017

Test collection is failing when using the latest 3.2.0 pytest. Currently it's not yet picked up on either travis or appveyor, but is used on circleCI. Getting a solution is critical, and I'm looking into it now. Alternatively we could limit the pytest version until this is solved.

============================= test session starts ==============================
platform linux2 -- Python 2.7.6, pytest-3.2.0, py-1.4.34, pluggy-0.4.0

Running tests with Astropy version 3.0.dev.
Running tests in lib.linux-i686-2.7/astropy docs.

Date: 2017-08-02T01:53:28

Platform: Linux-3.13.0-125-generic-i686-with-Ubuntu-14.04-trusty

Executable: /usr/bin/python

Full Python Version: 
2.7.6 (default, Oct 26 2016, 20:32:47) 
[GCC 4.8.4]

encodings: sys: ascii, locale: UTF-8, filesystem: UTF-8, unicode bits: 20
byteorder: little
float info: dig: 15, mant_dig: 15

Numpy: 1.12.1
Scipy: not available
Matplotlib: not available
h5py: not available
Pandas: not available
Cython: 0.25.2
Using Astropy options: remote_data: none.

rootdir: /tmp/astropy-test-lYT0mu, inifile: setup.cfg
collected 12700 items / 4 errors / 35 skipped

==================================== ERRORS ====================================
 ERROR collecting lib.linux-i686-2.7/astropy/coordinates/tests/test_finite_difference_velocities.py 
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/runner.py:191: in __init__
    self.result = func()
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/runner.py:370: in <lambda>
    lambda: list(collector.collect()),
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:389: in collect
    return super(Module, self).collect()
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:330: in collect
    res = self.makeitem(name, obj)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:342: in makeitem
    collector=self, name=name, obj=obj)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:745: in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:339: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:334: in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:613: in execute
    return _wrapped_call(hook_impl.function(*args), self.execute)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:250: in _wrapped_call
    wrap_controller.send(call_outcome)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:188: in pytest_pycollect_makeitem
    res = list(collector._genfunctions(name, obj))
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:362: in _genfunctions
    self.ihook.pytest_generate_tests(metafunc=metafunc)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:745: in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:339: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:334: in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:614: in execute
    res = hook_impl.function(*args)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:113: in pytest_generate_tests
    metafunc.parametrize(*marker.args, **marker.kwargs)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:781: in parametrize
    for x in argvalues]
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/mark.py:66: in extract_from
    warnings.warn(MARK_PARAMETERSET_UNPACKING)
E   RemovedInPytest4Warning: Applying marks directly to parameters is deprecated, please use pytest.param(..., marks=...) instead.
E   For more details, see: https://docs.pytest.org/en/latest/parametrize.html
_ ERROR collecting lib.linux-i686-2.7/astropy/io/ascii/tests/test_c_reader.py __
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/runner.py:191: in __init__
    self.result = func()
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/runner.py:370: in <lambda>
    lambda: list(collector.collect()),
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:389: in collect
    return super(Module, self).collect()
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:330: in collect
    res = self.makeitem(name, obj)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:342: in makeitem
    collector=self, name=name, obj=obj)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:745: in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:339: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:334: in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:613: in execute
    return _wrapped_call(hook_impl.function(*args), self.execute)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:250: in _wrapped_call
    wrap_controller.send(call_outcome)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:188: in pytest_pycollect_makeitem
    res = list(collector._genfunctions(name, obj))
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:362: in _genfunctions
    self.ihook.pytest_generate_tests(metafunc=metafunc)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:745: in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:339: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:334: in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:614: in execute
    res = hook_impl.function(*args)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:113: in pytest_generate_tests
    metafunc.parametrize(*marker.args, **marker.kwargs)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:781: in parametrize
    for x in argvalues]
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/mark.py:66: in extract_from
    warnings.warn(MARK_PARAMETERSET_UNPACKING)
E   RemovedInPytest4Warning: Applying marks directly to parameters is deprecated, please use pytest.param(..., marks=...) instead.
E   For more details, see: https://docs.pytest.org/en/latest/parametrize.html
_____ ERROR collecting lib.linux-i686-2.7/astropy/utils/tests/test_data.py _____
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/runner.py:191: in __init__
    self.result = func()
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/runner.py:370: in <lambda>
    lambda: list(collector.collect()),
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:389: in collect
    return super(Module, self).collect()
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:330: in collect
    res = self.makeitem(name, obj)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:342: in makeitem
    collector=self, name=name, obj=obj)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:745: in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:339: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:334: in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:613: in execute
    return _wrapped_call(hook_impl.function(*args), self.execute)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:250: in _wrapped_call
    wrap_controller.send(call_outcome)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:188: in pytest_pycollect_makeitem
    res = list(collector._genfunctions(name, obj))
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:362: in _genfunctions
    self.ihook.pytest_generate_tests(metafunc=metafunc)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:745: in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:339: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:334: in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:614: in execute
    res = hook_impl.function(*args)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:113: in pytest_generate_tests
    metafunc.parametrize(*marker.args, **marker.kwargs)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:781: in parametrize
    for x in argvalues]
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/mark.py:66: in extract_from
    warnings.warn(MARK_PARAMETERSET_UNPACKING)
E   RemovedInPytest4Warning: Applying marks directly to parameters is deprecated, please use pytest.param(..., marks=...) instead.
E   For more details, see: https://docs.pytest.org/en/latest/parametrize.html
_____ ERROR collecting lib.linux-i686-2.7/astropy/utils/tests/test_data.py _____
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/runner.py:191: in __init__
    self.result = func()
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/runner.py:370: in <lambda>
    lambda: list(collector.collect()),
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:389: in collect
    return super(Module, self).collect()
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:330: in collect
    res = self.makeitem(name, obj)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:342: in makeitem
    collector=self, name=name, obj=obj)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:745: in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:339: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:334: in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:613: in execute
    return _wrapped_call(hook_impl.function(*args), self.execute)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:250: in _wrapped_call
    wrap_controller.send(call_outcome)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:188: in pytest_pycollect_makeitem
    res = list(collector._genfunctions(name, obj))
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:362: in _genfunctions
    self.ihook.pytest_generate_tests(metafunc=metafunc)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:745: in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:339: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:334: in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/vendored_packages/pluggy.py:614: in execute
    res = hook_impl.function(*args)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:113: in pytest_generate_tests
    metafunc.parametrize(*marker.args, **marker.kwargs)
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/python.py:781: in parametrize
    for x in argvalues]
/usr/local/lib/python2.7/dist-packages/pytest-3.2.0-py2.7.egg/_pytest/mark.py:66: in extract_from
    warnings.warn(MARK_PARAMETERSET_UNPACKING)
E   RemovedInPytest4Warning: Applying marks directly to parameters is deprecated, please use pytest.param(..., marks=...) instead.
E   For more details, see: https://docs.pytest.org/en/latest/parametrize.html
=============================== warnings summary ===============================
None
  [pytest] section in setup.cfg files is deprecated, use [tool:pytest] instead.

-- Docs: http://doc.pytest.org/en/latest/warnings.html
!!!!!!!!!!!!!!!!!!! Interrupted: 4 errors during collection !!!!!!!!!!!!!!!!!!!!
=============== 35 skipped, 1 warnings, 4 error in 23.28 seconds ===============

./.run_docker_tests.sh returned exit code 2
@bsipocz bsipocz added the testing label Aug 2, 2017
@bsipocz bsipocz added this to the v2.0.2 milestone Aug 2, 2017
@astrofrog
Copy link
Member

I'll take a look to see if I can fix it as part of #6415

@astrofrog
Copy link
Member

Ah sorry you are looking into a solution, so ignore me. I'll leave you to take a look :)

@astrofrog
Copy link
Member

I would suggest let's just try and fix it and only restrict the pytest version if a fix isn't easy.

@bsipocz
Copy link
Member Author

bsipocz commented Aug 2, 2017

The solution seems to be trivial, PR is coming soon.

@drdavella
Copy link
Contributor

I guess this means open PRs will need to be rebased onto your fix once it's merged?

@bsipocz
Copy link
Member Author

bsipocz commented Aug 2, 2017

@drdavella - yes, either way they need to get the circleCI pass.

@larrybradley
Copy link
Member

Thanks, @bsipocz. I started working on this exact same thing this morning, but got interrupted by meetings.

@bsipocz
Copy link
Member Author

bsipocz commented Aug 2, 2017

@larrybradley - No problem. However we run into new issues that relates to a bug (or at least I think it's a bug), so there will be a version limitation in ci-helpers for pytest <3.2 for a while.
Photutils may need that limitation for it's circle, too, but I'll look into that in a PR shortly.

@pllim
Copy link
Member

pllim commented Aug 2, 2017

So... Does this affect affiliated packages? 😱

@bsipocz
Copy link
Member Author

bsipocz commented Aug 2, 2017

photutils and astroquery are fine, but it may affect others, too. This actually only had a few month long deprecation period, and no warnings were issued before this error, so I'm not sure how we were supposed to notice it in time.

@larrybradley
Copy link
Member

regions seems to be fine too.

@bsipocz
Copy link
Member Author

bsipocz commented Aug 3, 2017

A follow-up on this based on the discussion over there in the pytest repo. They haven't yet removed this deprecation but raise a deprecation warning. We see it as an error as we turn every deprecation into an exception and unfortunately it's a bit messy when the warning is issues at collection time.

Also as it happens at collection time, none of our machinery is suitable to ignore these warnings when enable_deprecations_as_exceptions is opted in.

@astrofrog
Copy link
Member

Can we not list the warning here? https://github.com/astropy/astropy/blob/master/astropy/tests/helper.py#L140

@bsipocz
Copy link
Member Author

bsipocz commented Aug 3, 2017

Hmm, I haven't tried that one yet, but the other two doesn't work (modules_to_ignore_on_import, or warnings_to_ignore_entire_module)

@pllim
Copy link
Member

pllim commented Aug 3, 2017

I have a feeling it won't work either, as all of those happen consecutively in the same function. No harm trying though.

@pllim
Copy link
Member

pllim commented Aug 3, 2017

What about using the -W option? https://docs.python.org/3/using/cmdline.html?highlight=#cmdoption-W

@bsipocz
Copy link
Member Author

bsipocz commented Aug 3, 2017

@astrofrog - brilliant, it works!

Executable: /Users/bsipocz/.virtualenvs/astropy-dev/bin/python

Full Python Version: 
3.5.3 (default, Apr 29 2017, 10:12:19) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)]

encodings: sys: utf-8, locale: UTF-8, filesystem: utf-8
byteorder: little
float info: dig: 15, mant_dig: 15

Numpy: 1.13.1
Scipy: 0.19.0
Matplotlib: 2.0.2
Pandas: 0.19.2
Astropy: 3.0.dev19709
scikit-image: 0.13.0
Using Astropy options: remote_data: none.

rootdir: /private/var/folders/dc/hsm7tqpx2d57n7vb3k1l81xw0000gq/T/photutils-test-5fbvy53e, inifile: setup.cfg
plugins: arraydiff-0.2.dev0, xdist-1.15.0, pep8-1.0.6, mpl-0.7, mock-1.6.0, cov-2.4.0, hypothesis-3.8.3
collected 1119 items 

photutils/aperture/bounding_box.py ..
photutils/aperture/tests/test_aperture_photometry.py .........................................s..............
photutils/aperture/tests/test_bounding_box.py ..........
photutils/background/core.py .........
photutils/background/tests/test_background_2d.py .......................
photutils/background/tests/test_core.py ......................
photutils/centroids/tests/test_core.py ........................
photutils/datasets/load.py .
photutils/datasets/make.py ....
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/sw/lib/python3.5/site-packages/_pytest/main.py", line 569, in location
INTERNALERROR>     return self._location
INTERNALERROR> AttributeError: 'DocTestTextfilePlus' object has no attribute '_location'
INTERNALERROR> 
INTERNALERROR> During handling of the above exception, another exception occurred:
INTERNALERROR> 
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/sw/lib/python3.5/site-packages/_pytest/main.py", line 110, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/sw/lib/python3.5/site-packages/_pytest/main.py", line 146, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/sw/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/sw/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/sw/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
INTERNALERROR>     _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR>   File "/sw/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/sw/lib/python3.5/site-packages/_pytest/main.py", line 169, in pytest_runtestloop
INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR>   File "/sw/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/sw/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/sw/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
INTERNALERROR>     _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR>   File "/sw/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 613, in execute
INTERNALERROR>     return _wrapped_call(hook_impl.function(*args), self.execute)
INTERNALERROR>   File "/sw/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 254, in _wrapped_call
INTERNALERROR>     return call_outcome.get_result()
INTERNALERROR>   File "/sw/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 279, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/sw/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 265, in __init__
INTERNALERROR>     self.result = func()
INTERNALERROR>   File "/sw/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/sw/lib/python3.5/site-packages/_pytest/runner.py", line 65, in pytest_runtest_protocol
INTERNALERROR>     nodeid=item.nodeid, location=item.location,
INTERNALERROR>   File "/sw/lib/python3.5/site-packages/_pytest/main.py", line 571, in location
INTERNALERROR>     location = self.reportinfo()
INTERNALERROR>   File "/sw/lib/python3.5/site-packages/_pytest/doctest.py", line 143, in reportinfo
INTERNALERROR>     return self.fspath, self.dtest.lineno, "[doctest] %s" % self.name
INTERNALERROR> AttributeError: 'NoneType' object has no attribute 'lineno'

============== 150 passed, 1 skipped, 1 warnings in 23.29 seconds ==============

@pllim
Copy link
Member

pllim commented Aug 3, 2017

it works!

Well... ignore my comments then. 😅

@bsipocz
Copy link
Member Author

bsipocz commented Aug 3, 2017

@pllim - that was my instinct, too thus haven't even tried it out yesterday along with the others 😄

@bwinkel
Copy link
Contributor

bwinkel commented Aug 3, 2017

So... Does this affect affiliated packages? 😱

I'm using the astropy package template and, yes, am affected by the bug.

@bsipocz
Copy link
Member Author

bsipocz commented Aug 3, 2017

@bwinkel - I've just merged the ci-helpers PR that limits pytest to be <3.2, so affiliates should be fine for now. Nevertheless it's worth trying it locally and fix any issues that is triggered by the package itself.

Once we worked out the issues in astropy core I'll send out an e-mail to astropy-dev and the affiliate maintainers mailing list about the workarounds affiliates can have.

@bwinkel
Copy link
Contributor

bwinkel commented Aug 4, 2017

@bsipocz - Thanks!

Nevertheless it's worth trying it locally and fix any issues that is triggered by the package itself.

Unfortunately, I have no idea what could go wrong in my .rst files. If I run the doctests individually on them, every single one of them seems to fail. I'm not sure if this is related to a warning (as expected), if I run

python setup.py test -a  -Wignore

I still get the error messages (see below). The tests return with exit code 3 in both cases.

INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/bwinkel/local/miniconda3/lib/python3.6/site-packages/_pytest/main.py", line 569, in location
INTERNALERROR>     return self._location
INTERNALERROR> AttributeError: 'DocTestTextfilePlus' object has no attribute '_location'
INTERNALERROR> 
INTERNALERROR> During handling of the above exception, another exception occurred:
INTERNALERROR> 
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/bwinkel/local/miniconda3/lib/python3.6/site-packages/_pytest/main.py", line 110, in wrap_session
...
INTERNALERROR>     nodeid=item.nodeid, location=item.location,
INTERNALERROR>   File "/home/bwinkel/local/miniconda3/lib/python3.6/site-packages/_pytest/main.py", line 571, in location
INTERNALERROR>     location = self.reportinfo()
INTERNALERROR>   File "/home/bwinkel/local/miniconda3/lib/python3.6/site-packages/_pytest/doctest.py", line 143, in reportinfo
INTERNALERROR>     return self.fspath, self.dtest.lineno, "[doctest] %s" % self.name
INTERNALERROR> AttributeError: 'NoneType' object has no attribute 'lineno'

@bsipocz
Copy link
Member Author

bsipocz commented Aug 4, 2017

Is this happening locally? The quickest fix is to downgrade pytest to <3.2. I'll send out more info probably later today.

@bwinkel
Copy link
Contributor

bwinkel commented Aug 4, 2017

I first encountered this on travis/appveyor, but I can reproduce it on my machine if is use pytest=3.2.

@bwinkel
Copy link
Contributor

bwinkel commented Aug 4, 2017

@bsipocz, you did not change it for the appveyor script, did you? Sorry to bother you.

@bsipocz
Copy link
Member Author

bsipocz commented Aug 4, 2017

It should be limited to <3.2 in appveyor, too. If you find it otherwise, could you post the link here?

@bwinkel
Copy link
Contributor

bwinkel commented Aug 4, 2017

https://ci.appveyor.com/project/bwinkel/pycraf/build/job/wx6pf494meo6e358

It's strange; if you look at lines 54-65:

Python 3.5.3
pytest <3.2  <------- Here it's <3.2
Fetching package metadata .................
Solving package specifications: .
Package plan for installation in environment C:\conda\envs\test:
The following NEW packages will be INSTALLED:
    colorama: 0.3.9-py35_0  conda-forge
    py:       1.4.34-py35_0 conda-forge
    pytest:   3.2.0-py35_0  conda-forge  <------- But 3.2 gets installed

@bsipocz
Copy link
Member Author

bsipocz commented Aug 4, 2017

@bwinkel - Thanks, that indeed is an issue. I'll ping you once the fix is done.

@bsipocz
Copy link
Member Author

bsipocz commented Aug 4, 2017

@bwinkel - try restarting now.

@bwinkel
Copy link
Contributor

bwinkel commented Aug 4, 2017

@bsipocz - It works. Thanks a lot, I appreciate your help.

@adrn
Copy link
Member

adrn commented Sep 11, 2017

@bsipocz Just confirming: the fix for this is still to use pytest<3.2? I keep running in to this in my own packages (locally).

@bsipocz
Copy link
Member Author

bsipocz commented Sep 11, 2017

Yes, that's the quickest workaround. You don't see it on travis as ci-helpers currently limits pytest to <3.2 unless it's overridden with the PYTEST_VERSION variable.

However locally everything should be fine also if you have astropy dev. If you keep seeing issue that means that you package also have affected code. If that's the case, feel free to ping me on a GH issue that has the details.

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

Successfully merging a pull request may close this issue.

7 participants