ejeschke / ginga

The Ginga astronomical FITS file viewer
BSD 3-Clause "New" or "Revised" License
121 stars 77 forks source link

pytest errors #965

Closed ejeschke closed 3 years ago

ejeschke commented 3 years ago

Was seeing this warning while running tests recently:

$ pytest ginga/tests
...
=============================== warnings summary ===============================
/home/eric/miniconda3/envs/py37/lib/python3.7/site-packages/_pytest/config/__init__.py:1148
  /home/eric/miniconda3/envs/py37/lib/python3.7/site-packages/_pytest/config/__init__.py:1148: PytestConfigWarning: Unknown config ini key: astropy_header

    self._warn_or_fail_if_strict("Unknown config ini key: {}\n".format(key))

-- Docs: https://docs.pytest.org/en/stable/warnings.html
================== 170 passed, 14 skipped, 1 warning in 3.98s ==================

so I upgraded pytest from 6.0.1 to 6.2.4. With this new version, I get an enhanced traceback of the same error (complaining about unknown key for astropy_header):

$ pytest ginga/tests
============================= test session starts ==============================
platform linux -- Python 3.7.3, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /home/eric/Git/ginga-naoj3, configfile: setup.cfg
collected 172 items                                                            
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/eric/miniconda3/envs/py37/lib/python3.7/site-packages/_pytest/main.py", line 269, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/home/eric/miniconda3/envs/py37/lib/python3.7/site-packages/_pytest/main.py", line 322, in _main
INTERNALERROR>     config.hook.pytest_collection(session=session)
INTERNALERROR>   File "/home/eric/miniconda3/envs/py37/lib/python3.7/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/home/eric/miniconda3/envs/py37/lib/python3.7/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/eric/miniconda3/envs/py37/lib/python3.7/site-packages/pluggy/manager.py", line 87, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/home/eric/miniconda3/envs/py37/lib/python3.7/site-packages/pluggy/callers.py", line 203, in _multicall
INTERNALERROR>     gen.send(outcome)
INTERNALERROR>   File "/home/eric/miniconda3/envs/py37/lib/python3.7/site-packages/_pytest/config/__init__.py", line 1210, in pytest_collection
INTERNALERROR>     self._validate_config_options()
INTERNALERROR>   File "/home/eric/miniconda3/envs/py37/lib/python3.7/site-packages/_pytest/config/__init__.py", line 1233, in _validate_config_options
INTERNALERROR>     self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
INTERNALERROR>   File "/home/eric/miniconda3/envs/py37/lib/python3.7/site-packages/_pytest/config/__init__.py", line 1269, in _warn_or_fail_if_strict
INTERNALERROR>     self.issue_config_time_warning(PytestConfigWarning(message), stacklevel=3)
INTERNALERROR>   File "/home/eric/miniconda3/envs/py37/lib/python3.7/site-packages/_pytest/config/__init__.py", line 1321, in issue_config_time_warning
INTERNALERROR>     warnings.warn(warning, stacklevel=stacklevel)
INTERNALERROR> pytest.PytestConfigWarning: Unknown config option: astropy_header

============================ no tests ran in 1.62s =============================

Is this just something I need to clear out of a pytest cache or something?

pllim commented 3 years ago

Did you do a pip install -e .[test]?

https://github.com/ejeschke/ginga/blob/16cfda98cb1f919ead60dbe941145c3a5ee4fa0b/setup.cfg#L65

ejeschke commented 3 years ago

No, that definitely fixed things. Thanks for the quick answer!

ejeschke commented 3 years ago

I think I had manually installed pytest-astropy-header previously and forgotten about it, because I had been running the tests for quite a while without problem. Upgrading the conda environment must have invalidated it.