Applied-GeoSolutions / gips

Geospatial Image Processing System
GNU General Public License v3.0
17 stars 5 forks source link

Error running modis_fetch tests: conflicting option string(s): --log-level #474

Closed rickemery closed 6 years ago

rickemery commented 6 years ago
root@aster:~/gips# py.test gips/test/unit/t_modis_fetch.py 
Traceback (most recent call last):
  File "/usr/local/bin/py.test", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/_pytest/config.py", line 50, in main
    config = _prepareconfig(args, plugins)
  File "/usr/local/lib/python2.7/dist-packages/_pytest/config.py", line 160, in _prepareconfig
    pluginmanager=pluginmanager, args=args)
  File "/usr/local/lib/python2.7/dist-packages/pluggy/__init__.py", line 617, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pluggy/__init__.py", line 222, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pluggy/__init__.py", line 216, in <lambda>
    firstresult=hook.spec_opts.get('firstresult'),
  File "/usr/local/lib/python2.7/dist-packages/pluggy/callers.py", line 196, in _multicall
    gen.send(outcome)
  File "/usr/local/lib/python2.7/dist-packages/_pytest/helpconfig.py", line 68, in pytest_cmdline_parse
    config = outcome.get_result()
  File "/usr/local/lib/python2.7/dist-packages/pluggy/callers.py", line 77, in get_result
    _reraise(*ex)  # noqa
  File "/usr/local/lib/python2.7/dist-packages/pluggy/callers.py", line 180, in _multicall
    res = hook_impl.function(*args)
  File "/usr/local/lib/python2.7/dist-packages/_pytest/config.py", line 942, in pytest_cmdline_parse
    self.parse(args)
  File "/usr/local/lib/python2.7/dist-packages/_pytest/config.py", line 1112, in parse
    args = self._parser.parse_setoption(args, self.option, namespace=self.option)
  File "/usr/local/lib/python2.7/dist-packages/_pytest/config.py", line 547, in parse_setoption
    parsedoption = self.parse(args, namespace=namespace)
  File "/usr/local/lib/python2.7/dist-packages/_pytest/config.py", line 526, in parse
    self.optparser = self._getparser()
  File "/usr/local/lib/python2.7/dist-packages/_pytest/config.py", line 541, in _getparser
    arggroup.add_argument(*n, **a)
  File "/usr/lib/python2.7/argparse.py", line 1308, in add_argument
    return self._add_action(action)
  File "/usr/lib/python2.7/argparse.py", line 1509, in _add_action
    action = super(_ArgumentGroup, self)._add_action(action)
  File "/usr/lib/python2.7/argparse.py", line 1322, in _add_action
    self._check_conflict(action)
  File "/usr/lib/python2.7/argparse.py", line 1460, in _check_conflict
    conflict_handler(action, confl_optionals)
  File "/usr/lib/python2.7/argparse.py", line 1467, in _handle_conflict_error
    raise ArgumentError(action, message % conflict_string)
argparse.ArgumentError: argument --log-level: conflicting option string(s): --log-level

Work around: Delete parser.addoption("--log-level", dest='log_level', help=help_str) from conftest.py

rickemery commented 6 years ago

This is on dhscratch and dev branches

ra-tolson commented 6 years ago

breadcrumb for whomever fixes this: Run py.test with a debug statement right before log_level getting set, see if it's already there.

ra-tolson commented 6 years ago

It looks like log_level is set by new versions of pytest, as pytest has integrated logging that it didn't have previously:

https://docs.pytest.org/en/latest/logging.html

However, log_level itself is undocumented (naturally).

ra-tolson commented 6 years ago

It looks like pytest 3.2.5 is safe from this problem, and this other one I found while trying to fix it:

https://github.com/pytest-dev/pytest/issues/3046

To fix this issue itself, I want to remove logging from the gips system tests completely. It was a misfeature that I kinda regret: All people ever did was pass -s --ll debug, as a practically mandatory feature for gips system test runs.

What you're supposed to do instead is just print things, then rely on pytest's -s option to control whether or not you see your printouts. That's what I want to put in its place.