Skip to content
Snippets Groups Projects
Commit ffb85ccd authored by Ashwin Kumar Karnad's avatar Ashwin Kumar Karnad
Browse files

first attemp at tests for metadata logging

parent 217397e7
No related branches found
No related tags found
1 merge request!28improve machine readable logging
...@@ -8,6 +8,7 @@ import subprocess ...@@ -8,6 +8,7 @@ import subprocess
from pathlib import Path from pathlib import Path
import pytest import pytest
import logging
mod = importlib.import_module("mpsd-software-environment") mod = importlib.import_module("mpsd-software-environment")
...@@ -314,6 +315,14 @@ def test_install_environment_zlib(): ...@@ -314,6 +315,14 @@ def test_install_environment_zlib():
lines = f.read() lines = f.read()
assert "zlib" in lines assert "zlib" in lines
def test_metadata_logging(tmp_path):
mod.set_up_logging("WARNING", tmp_path/"test.log")
key = "important_key"
value = "important_value"
mod.log_metadata(key,value)
expected_log = f"{mod.config_vars['metadata_tag_open']}{key}:{value}{mod.config_vars['metadata_tag_close']}"
with open(tmp_path/"test.log", "r") as f:
assert expected_log in f.read()
def test_interface(tmp_path): def test_interface(tmp_path):
"""Test other things (not implemented yet).""" """Test other things (not implemented yet)."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment