Select Git revision
test_run_environment.py
test_run_environment.py 1.16 KiB
import logging
from mlair.helpers import TimeTracking, PyTestRegex
from mlair.run_modules.run_environment import RunEnvironment
class TestRunEnvironment:
def test_enter(self, caplog):
caplog.set_level(logging.INFO)
with RunEnvironment() as r:
assert caplog.record_tuples[-1] == ('root', 20, 'RunEnvironment started')
assert isinstance(r.time, TimeTracking)
def test_exit(self, caplog):
caplog.set_level(logging.INFO)
with RunEnvironment() as r:
r.do_stuff(0.1)
expression = PyTestRegex(r"RunEnvironment finished after \d+:\d+:\d+ \(hh:mm:ss\)")
assert ('root', 20, expression) in caplog.record_tuples[-3:]
def test_init(self, caplog):
caplog.set_level(logging.INFO)
r = RunEnvironment()
assert caplog.record_tuples[-1] == ('root', 20, 'RunEnvironment started')
def test_del(self, caplog):
caplog.set_level(logging.INFO)
r = RunEnvironment()
r.do_stuff(0.2)
del r
expression = PyTestRegex(r"RunEnvironment finished after \d+:\d+:\d+ \(hh:mm:ss\)")
assert ('root', 20, expression) in caplog.record_tuples[-3:]