astropy: 4.0 rc1: Can't disable deprecation errors
On the Debian build, I want/need to disable the interpretation of deprecation warnings as error. This is required, since currently some modules issue deprecation warnings with Python 3.8, and generally they are too strict to have them as failures since they then prevent upgrading some packages. I currently disable the deprecation warnings with a small patch which removes these lines: https://github.com/astropy/astropy/blob/aad16d652d8d3897e7f51dc54590e2974df35564/astropy/conftest.py#L25-L30
This however seems not to disable everything; even with this patch I can’t run the tests (during build time):
I: pybuild base:217: cd '/build/astropy-4.0~rc1/.pybuild/cpython3_3.8/build'; python3.8 -m pytest
============================= test session starts ==============================
platform linux -- Python 3.8.0+, pytest-4.6.6, py-1.8.0, pluggy-0.13.0
Matplotlib: 3.0.2
Freetype: 2.10.1
rootdir: /build/astropy-4.0~rc1, inifile: setup.cfg
plugins: arraydiff-0.3, remotedata-0.3.2, astropy-header-0.1.1, mpl-0.10, openfiles-0.4.0, doctestplus-0.5.0
collected 0 items / 1 errors
==================================== ERRORS ====================================
________________________ ERROR collecting test session _________________________
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:440: in _importconftest
return self._conftestpath2mod[conftestpath]
E KeyError: local('/build/astropy-4.0~rc1/.pybuild/cpython3_3.8/build/astropy/conftest.py')
During handling of the above exception, another exception occurred:
/usr/lib/python3/dist-packages/py/_path/common.py:377: in visit
for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
/usr/lib/python3/dist-packages/py/_path/common.py:418: in gen
dirs = self.optsort([p for p in entries
/usr/lib/python3/dist-packages/py/_path/common.py:419: in <listcomp>
if p.check(dir=1) and (rec is None or rec(p))])
/usr/lib/python3/dist-packages/_pytest/main.py:667: in _recurse
ihook = self.gethookproxy(dirpath)
/usr/lib/python3/dist-packages/_pytest/main.py:482: in gethookproxy
my_conftestmodules = pm._getconftestmodules(fspath)
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:424: in _getconftestmodules
mod = self._importconftest(conftestpath.realpath())
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:474: in _importconftest
self.consider_conftest(mod)
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:527: in consider_conftest
self.register(conftestmodule, name=conftestmodule.__file__)
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:321: in register
ret = super(PytestPluginManager, self).register(plugin, name)
/usr/lib/python3/dist-packages/pluggy/manager.py:126: in register
hook._maybe_apply_history(hookimpl)
/usr/lib/python3/dist-packages/pluggy/hooks.py:333: in _maybe_apply_history
res = self._hookexec(self, [method], kwargs)
/usr/lib/python3/dist-packages/pluggy/manager.py:92: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/usr/lib/python3/dist-packages/pluggy/manager.py:83: in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
astropy/conftest.py:35: in pytest_configure
matplotlibrc_cache.update(matplotlib.rcParams)
/usr/lib/python3/dist-packages/matplotlib/__init__.py:886: in __getitem__
cbook.warn_deprecated(
/usr/lib/python3/dist-packages/matplotlib/cbook/deprecation.py:112: in warn_deprecated
warnings.warn(message, category, stacklevel=2)
E matplotlib.cbook.deprecation.MatplotlibDeprecationWarning:
E examples.directory is deprecated; in the future, examples will be found relative to the 'datapath' directory.
!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!
=========================== 1 error in 0.20 seconds ============================
E: pybuild pybuild:341: test: plugin distutils failed with: exit code=2: cd '/build/astropy-4.0~rc1/.pybuild/cpython3_3.8/build'; python3.8 -m pytest
dh_auto_test: pybuild --test --test-pytest -i python{version} -p "3.8 3.7" returned exit code 13
I am not sure whether I did something wrong; however I don’t see how I could disable them otherwise. I also must admit that I don’t understand the warning. I also don’t understand the key error on top. Matplotlib version is 3.0.2, built for both Python 3.8 and 3.7.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 20 (20 by maintainers)
Adding
ignore:examples.directory is deprecated
tofilterwarnings
didn’t help; it still stopped on the same place. With the removal of theerror
line, it worked.For that particular warning I think we should just catch it in
conftest.py
with awith warnings.catch_warnings...