RuntimeError: 'auto_spec' might be a typo; use unsafe=True if this is intended
See original GitHub issueDescribe 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:
- Clone Repo
- make run
Expected behavior Expected to have no errors
Desktop (please complete the following information):
- OS: macOS Big Sur 11.6
Issue Analytics
- State:
- Created 2 years ago
- Comments:8
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I pushed to my joe-dev branch. Can you test this?
Looks like I need to use
autospec
.