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.

RuntimeError: 'auto_spec' might be a typo; use unsafe=True if this is intended

See original GitHub issue

Describe the bug I have just cloned the newly forked repository, installed dependencies (requirements.txt and requirements_dev.txt), and ran make test. I also get the same error whenever I try to run any of the tests.

# make test
python setup.py test
.../.local/share/virtualenvs/virlutils-kPIYcbLj/lib/python3.10/site-packages/setuptools/dist.py:717: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
  warnings.warn(
running test
WARNING: Testing via this command is deprecated and will be removed in a future version. Users looking for a generic test entry point independent of test runner are encouraged to use tox.


.../.local/share/virtualenvs/virlutils-kPIYcbLj/lib/python3.10/site-packages/setuptools/dist.py:812: UserWarning: Module enum was already imported from /Users/tybruno/.pyenv/versions/3.10.0/lib/python3.10/enum.py, but .../PycharmProjects/virlutils/.eggs/enum34-1.1.10-py3.10.egg is being added to sys.path
  pkg_resources.working_set.add(dist, replace=True)
running egg_info
creating virlutils.egg-info
writing virlutils.egg-info/PKG-INFO
writing dependency_links to virlutils.egg-info/dependency_links.txt
writing entry points to virlutils.egg-info/entry_points.txt
writing requirements to virlutils.egg-info/requires.txt
writing top-level names to virlutils.egg-info/top_level.txt
writing manifest file 'virlutils.egg-info/SOURCES.txt'
reading manifest file 'virlutils.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE'
writing manifest file 'virlutils.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
  File ".../PycharmProjects/virlutils/setup.py", line 26, in <module>
    setup(
  File ".../.local/share/virtualenvs/virlutils-kPIYcbLj/lib/python3.10/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File ".../.pyenv/versions/3.10.0/lib/python3.10/distutils/core.py", line 148, in setup
    dist.run_commands()
  File ".../.pyenv/versions/3.10.0/lib/python3.10/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File ".../.pyenv/versions/3.10.0/lib/python3.10/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File ".../.local/share/virtualenvs/virlutils-kPIYcbLj/lib/python3.10/site-packages/setuptools/command/test.py", line 223, in run
    self.run_tests()
  File ".../.local/share/virtualenvs/virlutils-kPIYcbLj/lib/python3.10/site-packages/setuptools/command/test.py", line 226, in run_tests
    test = unittest.main(
  File ".../.pyenv/versions/3.10.0/lib/python3.10/unittest/main.py", line 100, in __init__
    self.parseArgs(argv)
  File ".../.pyenv/versions/3.10.0/lib/python3.10/unittest/main.py", line 147, in parseArgs
    self.createTests()
  File ".../.pyenv/versions/3.10.0/lib/python3.10/unittest/main.py", line 158, in createTests
    self.test = self.testLoader.loadTestsFromNames(self.testNames,
  File ".../.pyenv/versions/3.10.0/lib/python3.10/unittest/loader.py", line 220, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File ".../.pyenv/versions/3.10.0/lib/python3.10/unittest/loader.py", line 220, in <listcomp>
    suites = [self.loadTestsFromName(name, module) for name in names]
  File ".../.pyenv/versions/3.10.0/lib/python3.10/unittest/loader.py", line 191, in loadTestsFromName
    return self.loadTestsFromModule(obj)
  File ".../.local/share/virtualenvs/virlutils-kPIYcbLj/lib/python3.10/site-packages/setuptools/command/test.py", line 56, in loadTestsFromModule
    tests.append(self.loadTestsFromName(submodule))
  File ".../.pyenv/versions/3.10.0/lib/python3.10/unittest/loader.py", line 191, in loadTestsFromName
    return self.loadTestsFromModule(obj)
  File ".../.local/share/virtualenvs/virlutils-kPIYcbLj/lib/python3.10/site-packages/setuptools/command/test.py", line 56, in loadTestsFromModule
    tests.append(self.loadTestsFromName(submodule))
  File ".../.pyenv/versions/3.10.0/lib/python3.10/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File ".../PycharmProjects/virlutils/tests/v1/swagger.py", line 13, in <module>
    class Tests(BaseTest):
  File ".../PycharmProjects/virlutils/tests/v1/swagger.py", line 15, in Tests
    @patch("virl.cli.swagger.commands.subprocess.Popen", auto_spec=False)
  File ".../.pyenv/versions/3.10.0/lib/python3.10/unittest/mock.py", line 1767, in patch
    return _patch(
  File ".../.pyenv/versions/3.10.0/lib/python3.10/unittest/mock.py", line 1286, in __init__
    _check_spec_arg_typos(kwargs)
  File ".../.pyenv/versions/3.10.0/lib/python3.10/unittest/mock.py", line 1262, in _check_spec_arg_typos
    raise RuntimeError(
RuntimeError: 'auto_spec' might be a typo; use unsafe=True if this is intended
make: *** [test] Error 1

To Reproduce Steps to reproduce the behavior:

  1. Clone Repo
  2. make run

Expected behavior Expected to have no errors

Desktop (please complete the following information):

  • OS: macOS Big Sur 11.6

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
xorrkazcommented, Oct 19, 2021

I pushed to my joe-dev branch. Can you test this?

1reaction
xorrkazcommented, Oct 19, 2021

Looks like I need to use autospec.

Read more comments on GitHub >

github_iconTop Results From Across the Web

When should I use `autospec=True` with the mock library?
I fear not using autospec may result in tests not breaking when they really should break, as described in the mentioned article.
Read more >
1913266 – mkdocs fails to build with Python 3.10: ImportError
Doc Type: If docs needed, set a value ... raise RuntimeError( RuntimeError: 'auto_spec' might be a typo; use unsafe=True if this is intended...
Read more >
cpython/mock.py at main - unittest - GitHub
if typo in kwargs_to_check: raise RuntimeError(. f"{typo!r} might be a typo; use unsafe=True if this is intended". ) class _patch(object):.
Read more >
brython.info/src/Lib/unittest/mock.py
Use a spec " f"for the mock if {name!r} is meant to be an attribute. ... raise RuntimeError( f"{typo!r} might be a typo;...
Read more >
unittest.mock Python 3.6官方教程 _w3cschool - 编程狮
Auto-speccing can be done through the autospec argument to patch, ... A mock intended to be used as a property, or other descriptor,...
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