Skip to content

ImportError: cannot import name wraps #298

@grantmcconnaughey

Description

@grantmcconnaughey

I am getting an ImportError any time I run tests where I use mock. I'm using mock 1.3.0.

The error is ImportError: cannot import name wraps. It doesn't seem that installing mock requires six in setup.py when it probably should. And if it requires a specific version of six (one that has a function called wraps) then it should specify that as well.

Looks like I'm not the only one with this issue: http://stackoverflow.com/questions/31417964/importerror-cannot-import-name-wraps

Traceback:

ImportError: Failed to import test module: my_app.tests.test_forms
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 254, in _find_tests
    module = self._get_module_from_name(name)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/loader.py", line 232, in _get_module_from_name
    __import__(name)
  File "/Users/grant/my_app/tests/test_forms.py", line 2, in <module>
    from mock import patch, MagicMock
  File "/Users/grant/.virtualenvs/sidekick/lib/python2.7/site-packages/mock/__init__.py", line 2, in <module>
    import mock.mock as _mock
  File "/Users/grant/.virtualenvs/sidekick/lib/python2.7/site-packages/mock/mock.py", line 68, in <module>
    from six import wraps
ImportError: cannot import name wraps

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions