Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_exit_with_proper_error(self, failures, errors, error_code):
session = Session()
session.failures = failures
session.errors = errors
with pytest.raises(SystemExit) as excinfo:
session.exit()
assert excinfo.type == SystemExit
assert excinfo.value.code == error_code
def test_init_successes_and_failures(self):
session = Session()
assert session.successes == 0
assert session.failures == 0
def test_increment(self):
session = Session()
times = randrange(1, 10)
for _ in range(times):
session.increment_failures()
assert session.failures == times
def test_increment(self):
session = Session()
times = randrange(1, 10)
for _ in range(times):
session.increment_errors()
assert session.errors == times
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"
def test_increment(self):
session = Session()
times = randrange(1, 10)
for _ in range(times):
session.increment_successes()
assert session.successes == times
def test_failed_when_there_is_failure(self, failures, errors, expected):
session = Session()
session.failures = failures
session.errors = errors
assert session.succeed == expected
def test_init_started_at(self):
session = Session()
session.start()
assert str(session.started_at) == "2020-06-15 18:54:57"
sys.exit(self.exit_code)
def increment_successes(self):
self.successes += 1
def increment_failures(self):
self.failures += 1
def increment_errors(self):
self.errors += 1
def elapsed_time(self):
return datetime.now() - self.started_at
session = Session()