sure
sure copied to clipboard
BUG sure appears to break @patch.mock in python 3.6
Issue Type
BUG
Versions & Configuration
Sure: 1.4.11 Python: 3.6.3 Operating System: Mac
Steps to reproduce (Expected and Actual Results)
Write a test like:
from unittest import mock
import sure
@mock.patch('my_thing_to_mock', return_value=True) # Anything will work
def my_test(my_mock):
assert True == True # Don't even need to use sure
When I execute tests:
pytest
I will then receive an error like:
@mock.patch('my_thing_to_mock', return_value=True) # Anything will work
def my_test(my_mock):
E fixture 'my_mock' not found
> available fixtures: cache, capfd, capsys, cov, doctest_namespace, monkeypatch, pytestconfig, record_xml_property, recwarn, tmpdir, tmpdir_factory
> use 'pytest --fixtures [testpath]' for help on them.
I believe this is tied to sure's dependency on mock==2.0.0
my understanding from Mock is that mock is now part of the Python standard library, available as unittest.mock in Python 3.3 onwards.
.
Since sure
supports > 3.3 up to 3.7 I would expect that unittest.mock would be supported. However I could be doing it wrong! :D