Skip to content
Snippets Groups Projects
Select Git revision
  • 2019
  • 2025 default
  • 2024
  • 2023
  • 2021
  • 2017
6 results

JURON.md

Blame
  • test_run_environment.py 1.15 KiB
    import logging
    
    from src.helpers import TimeTracking, PyTestRegex
    from src.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 caplog.record_tuples[-1] == ('root', 20, expression)
    
        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 caplog.record_tuples[-1] == ('root', 20, expression)