DKorytkin / pytest-never-sleep

This plugin helps to avoid adding tests without mock `time.sleep`

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError: 'TestClass' object has no attribute 'fake_sleep'

DKorytkin opened this issue · comments

Versions

$ pip list
pytest             3.5.1
pytest-never-sleep 0.0.1

How to reproduce

import pytest 

class TestClass(object):
    @pytest.mark.disable_time_sleep
    def test_disable_time_sleep_mark(self):
        time.sleep(1)  # unstable

Exception

self = <tests.test_imports.TestClass object at 0x1095e1d10>

    @pytest.fixture
    def enable_time_sleep(self):
        """
            This fixture enable using `time.sleep` for particular tests
            """
>       with using_real_time_sleep(self.fake_sleep):
E       AttributeError: 'TestClass' object has no attribute 'fake_sleep'

self       = <tests.test_imports.TestClass object at 0x1095e1d10>