Exemple #1
0
        def test_return_time(self, freezer):
            session = Session()
            session.start()

            freezer.move_to("2020-06-15 18:56:38")

            assert str(session.elapsed_time()) == "0:01:41"
Exemple #2
0
    def test_increment(self):
        session = Session()
        times = randrange(1, 10)

        for _ in range(times):
            session.increment_errors()

        assert session.errors == times
Exemple #3
0
    def test_increment(self):
        session = Session()
        times = randrange(1, 10)

        for _ in range(times):
            session.increment_failures()

        assert session.failures == times
Exemple #4
0
    def test_exit_with_proper_error(self, failures, errors, error_code):
        session = Session()
        session.failures = failures
        session.errors = errors
        with raises(SystemExit) as excinfo:
            session.exit()

        assert excinfo.type == SystemExit
        assert excinfo.value.code == error_code
Exemple #5
0
    def test_init_started_at(self):
        session = Session()

        assert str(session.started_at) == "2020-06-15 18:54:57"
Exemple #6
0
 def test_failed_when_there_is_failure(self, failures, errors, expected):
     session = Session()
     session.failures = failures
     session.errors = errors
     assert session.succeed == expected
Exemple #7
0
    def test_init_successes_and_failures(self):
        session = Session()

        assert session.successes == 0
        assert session.failures == 0