Skip to content

Commit

Permalink
added test for generation of files (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
VanLaareN authored Jan 10, 2025
1 parent 1c27550 commit a1c120b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
Empty file added tests/__init__.py
Empty file.
Empty file.
23 changes: 23 additions & 0 deletions tests/generation-tests/test_generation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import sys
from pathlib import Path
import pytest

def test_generate(capsys):
root = Path(__file__).parent.parent.parent
sys.path.append(str(root))
from FileGenerator import FileGenerator

for i in range(1, 9):
topology_file = root / "controller_utils" / "examples" / f"{i}" / "topology.yaml"
output_path = root
fileGenerator = FileGenerator(topology_file, output_path)

# Capture and test output of generate_level_0
fileGenerator.generate_level_0()
captured = capsys.readouterr()
assert "error" not in captured.out.lower() and "error" not in captured.err.lower(), f"Error in {str(topology_file)}"

# Capture and test output of generate_level_1
fileGenerator.generate_level_1()
captured = capsys.readouterr()
assert "error" not in captured.out.lower() and "error" not in captured.err.lower(), f"Error in {str(topology_file)}"

0 comments on commit a1c120b

Please sign in to comment.