Created
September 4, 2017 13:29
-
-
Save disconnect3d/4bfadf3cb43d043de0707f9463c169d1 to your computer and use it in GitHub Desktop.
Is this the best way to return list like thing?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@pytest.fixture | |
def mock_time_in_ms(monkeypatch): | |
def _mock_time_in_ms(values_to_return): | |
idx = [0] | |
def _time(): | |
v = values_to_return[idx[0]] | |
idx[0] += 1 | |
return v | |
monkeypatch.setattr(some_module_that_uses_time_in_ms, 'time_in_ms', _time) | |
return _mock_time_in_ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment