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.

Argument --log-level in nameko conflicts with pytest.

See original GitHub issue

Argument in nameko conflicts with pytest

issue

  • Python: 3.6.3
  • pytest: 3.3.0
  • nameko: 2.8.1

### In an empty directory, run pytest.
# cd /tmp/test
# pip install pytest
# pip install nameko
# pytest

_Traceback (most recent call last):
  File "/tmp/test/py3/bin/pytest", line 11, in <module>
    sys.exit(main())
  File "/tmp/test/py3/lib/python3.6/site-packages/_pytest/config.py", line 50, in main
    config = _prepareconfig(args, plugins)
  File "/tmp/test/py3/lib/python3.6/site-packages/_pytest/config.py", line 160, in _prepareconfig
    pluginmanager=pluginmanager, args=args)
  File "/tmp/test/py3/lib/python3.6/site-packages/pluggy/__init__.py", line 617, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "/tmp/test/py3/lib/python3.6/site-packages/pluggy/__init__.py", line 222, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/tmp/test/py3/lib/python3.6/site-packages/pluggy/__init__.py", line 216, in <lambda>
    firstresult=hook.spec_opts.get('firstresult'),
  File "/tmp/test/py3/lib/python3.6/site-packages/pluggy/callers.py", line 196, in _multicall
    gen.send(outcome)
  File "/tmp/test/py3/lib/python3.6/site-packages/_pytest/helpconfig.py", line 68, in pytest_cmdline_parse
    config = outcome.get_result()
  File "/tmp/test/py3/lib/python3.6/site-packages/pluggy/callers.py", line 76, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/tmp/test/py3/lib/python3.6/site-packages/pluggy/callers.py", line 180, in _multicall
    res = hook_impl.function(*args)
  File "/tmp/test/py3/lib/python3.6/site-packages/_pytest/config.py", line 942, in pytest_cmdline_parse
    self.parse(args)
  File "/tmp/test/py3/lib/python3.6/site-packages/_pytest/config.py", line 1107, in parse
    self._preparse(args, addopts=addopts)
  File "/tmp/test/py3/lib/python3.6/site-packages/_pytest/config.py", line 1072, in _preparse
    self.known_args_namespace = ns = self._parser.parse_known_args(args, namespace=self.option.copy())
  File "/tmp/test/py3/lib/python3.6/site-packages/_pytest/config.py", line 556, in parse_known_args
    return self.parse_known_and_unknown_args(args, namespace=namespace)[0]
  File "/tmp/test/py3/lib/python3.6/site-packages/_pytest/config.py", line 562, in parse_known_and_unknown_args
    optparser = self._getparser()
  File "/tmp/test/py3/lib/python3.6/site-packages/_pytest/config.py", line 541, in _getparser
    arggroup.add_argument(*n, **a)
  File "/usr/lib/python3.6/argparse.py", line 1357, in add_argument
    return self._add_action(action)
  File "/usr/lib/python3.6/argparse.py", line 1561, in _add_action
    action = super(_ArgumentGroup, self)._add_action(action)
  File "/usr/lib/python3.6/argparse.py", line 1371, in _add_action
    self._check_conflict(action)
  File "/usr/lib/python3.6/argparse.py", line 1510, in _check_conflict
    conflict_handler(action, confl_optionals)
  File "/usr/lib/python3.6/argparse.py", line 1519, in _handle_conflict_error
    raise ArgumentError(action, message % conflict_string)
argparse.ArgumentError: argument --log-level: conflicting option string: --log-level_

reason

Nameko and pytest have the same option --log-level for pytest_addoption, so pytest will raise argparse.ArgumentError.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
askorski-fccommented, Dec 8, 2017

I have the exact same issue:

Traceback (most recent call last):
  File "/home/dummyuser/envs/dummyenv/bin/pytest", line 11, in <module>
    sys.exit(main())
  File "/home/dummyuser/envs/dummyenv/local/lib/python2.7/site-packages/_pytest/config.py", line 50, in main
    config = _prepareconfig(args, plugins)
  File "/home/dummyuser/envs/dummyenv/local/lib/python2.7/site-packages/_pytest/config.py", line 160, in _prepareconfig
    pluginmanager=pluginmanager, args=args)
  File "/home/dummyuser/envs/dummyenv/local/lib/python2.7/site-packages/pluggy/__init__.py", line 617, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "/home/dummyuser/envs/dummyenv/local/lib/python2.7/site-packages/pluggy/__init__.py", line 222, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/dummyuser/envs/dummyenv/local/lib/python2.7/site-packages/pluggy/__init__.py", line 216, in <lambda>
    firstresult=hook.spec_opts.get('firstresult'),
  File "/home/dummyuser/envs/dummyenv/local/lib/python2.7/site-packages/pluggy/callers.py", line 196, in _multicall
    gen.send(outcome)
  File "/home/dummyuser/envs/dummyenv/local/lib/python2.7/site-packages/_pytest/helpconfig.py", line 68, in pytest_cmdline_parse
    config = outcome.get_result()
  File "/home/dummyuser/envs/dummyenv/local/lib/python2.7/site-packages/pluggy/callers.py", line 77, in get_result
    _reraise(*ex)  # noqa
  File "/home/dummyuser/envs/dummyenv/local/lib/python2.7/site-packages/pluggy/callers.py", line 180, in _multicall
    res = hook_impl.function(*args)
  File "/home/dummyuser/envs/dummyenv/local/lib/python2.7/site-packages/_pytest/config.py", line 943, in pytest_cmdline_parse
    self.parse(args)
  File "/home/dummyuser/envs/dummyenv/local/lib/python2.7/site-packages/_pytest/config.py", line 1108, in parse
    self._preparse(args, addopts=addopts)
  File "/home/dummyuser/envs/dummyenv/local/lib/python2.7/site-packages/_pytest/config.py", line 1073, in _preparse
    self.known_args_namespace = ns = self._parser.parse_known_args(args, namespace=self.option.copy())
  File "/home/dummyuser/envs/dummyenv/local/lib/python2.7/site-packages/_pytest/config.py", line 557, in parse_known_args
    return self.parse_known_and_unknown_args(args, namespace=namespace)[0]
  File "/home/dummyuser/envs/dummyenv/local/lib/python2.7/site-packages/_pytest/config.py", line 563, in parse_known_and_unknown_args
    optparser = self._getparser()
  File "/home/dummyuser/envs/dummyenv/local/lib/python2.7/site-packages/_pytest/config.py", line 542, 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
  • Python 2.7.12
  • pytest 3.3.1
  • nameko 2.8.1

Downgrading pytest to a version lower than 3.3 indeed works.

0reactions
davidszottencommented, Dec 11, 2017

released as 2.8.2

Read more comments on GitHub >

github_iconTop Results From Across the Web

nameko - Read the Docs
Nameko is a framework for building microservices in Python. It comes with built-in support for: • RPC over AMQP.
Read more >
How to manage logging — pytest documentation
pytest captures log messages of level WARNING or above automatically and displays them in their own section for each failed test in the...
Read more >
pytest - specify log level from the CLI command running the tests
we have multiple layers of logging, we log out ERROR, WARNING, INFO and DEBUG. the default value for our logger is INFO. we...
Read more >
nameko Changelog - pyup.io
Remove the pytest `--log-level` argument added by the pytest plugin since this conflicts with newer versions of `pytest` (`>= 3.3.0`). For older
Read more >
[Example code]-Python 3 script for logging into a website using the ...
(Im using repl.it website for learning python3) · problems with a random number/letter ... How to set logging level for the module only...
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