Skip to content
Snippets Groups Projects
Commit 119fc5f5 authored by lukas leufen's avatar lukas leufen
Browse files

added test for new timetracking feature

parent d31cfad6
Branches
Tags
2 merge requests!37include new development,!30Lukas issue037 feat run without training
......@@ -109,10 +109,18 @@ class TestTimeTracking:
duration = t.stop(get_duration=True)
assert duration == t.duration()
def test_enter_exit(self, caplog):
caplog.set_level(logging.INFO)
with TimeTracking() as t:
assert t.start is not None
assert t.end is None
expression = PyTestRegex(r"undefined job finished after \d+:\d+:\d+ \(hh:mm:ss\)")
assert caplog.record_tuples[-1] == ('root', 20, expression)
class TestPrepareHost:
@mock.patch("socket.gethostname", side_effect=["linux-gzsx", "ZAM144", "zam347", "jrtest", "jwtest"])
@mock.patch("socket.gethostname", side_effect=["linux-aa9b", "ZAM144", "zam347", "jrtest", "jwtest"])
@mock.patch("os.getlogin", return_value="testUser")
@mock.patch("os.path.exists", return_value=True)
def test_prepare_host(self, mock_host, mock_user, mock_path):
......@@ -134,10 +142,10 @@ class TestPrepareHost:
prepare_host()
assert "unknown host 'NotExistingHostName'" in e.value.args[0]
if "runner-6HmDp9Qd-project-2411-concurrent" not in platform.node():
mock_host.return_value = "linux-gzsx"
mock_host.return_value = "linux-aa9b"
with pytest.raises(NotADirectoryError) as e:
prepare_host()
assert "does not exist for host 'linux-gzsx'" in e.value.args[0]
assert "does not exist for host 'linux-aa9b'" in e.value.args[0]
class TestSetExperimentName:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment