Skip to content

Commit

Permalink
Test aggregation to ensure correct processing of the input
Browse files Browse the repository at this point in the history
  • Loading branch information
gbaudino committed Nov 4, 2023
1 parent 67e12bf commit 45849c0
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions mezcla/tests/test_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

# Standard packages
import re
import subprocess

# Installed packages
import pytest
Expand All @@ -36,6 +37,10 @@ class TestTemplate(TestWrapper):
script_file = TestWrapper.get_module_file_path(__file__)
script_module = TestWrapper.get_testing_module_name(__file__)

@pytest.fixture(autouse=True)
def capfd(self, capfd):
self.capfd = capfd

def test_data_file(self):
"""Makes sure to-do grep works as expected"""
debug.trace(4, "TestTemplate.test_data_file()")
Expand All @@ -51,6 +56,18 @@ def test_something_else(self):
assert "todo" in THE_MODULE.TODO_ARG.lower()
return

def test_captured_input_line(self):
"""Ensure that lines are correctly processed and
irrelevant lines are effectively ignored"""
data = "hey"
cmd = f"echo {data} | DEBUG_LEVEL=4 python -m mezcla.template - 2>&1"
result = subprocess.run(cmd, shell=True, text=True)
assert result.returncode == 0
out, err = self.capfd.readouterr()
assert f"Ignoring line (1): {data}" in out
assert err == ""


#------------------------------------------------------------------------

if __name__ == '__main__':
Expand Down

0 comments on commit 45849c0

Please sign in to comment.