Speed up tests by mocking time.sleep()
This commit is contained in:
parent
d2861d029f
commit
fcebd63e66
3 changed files with 20 additions and 0 deletions
17
tests/conftest.py
Normal file
17
tests/conftest.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2019 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import time
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def nosleep(monkeypatch):
|
||||
|
||||
def sleep(seconds):
|
||||
pass
|
||||
|
||||
monkeypatch.setattr(time, 'sleep', sleep)
|
|
@ -28,6 +28,7 @@ def cmd_err(*options):
|
|||
assert cmd(*options) == 1
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("nosleep")
|
||||
class TestDosage(object):
|
||||
"""Test the dosage commandline client."""
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ from __future__ import absolute_import, division, print_function
|
|||
|
||||
import re
|
||||
|
||||
import pytest
|
||||
import responses
|
||||
|
||||
import dosagelib.cmd
|
||||
|
@ -16,6 +17,7 @@ def cmd(*options):
|
|||
assert dosagelib.cmd.main(("--allow-multiple",) + options) == 0
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("nosleep")
|
||||
class TestModules(object):
|
||||
"""Test that specific comic modules work correctly."""
|
||||
|
||||
|
|
Loading…
Reference in a new issue