Skip to content

Commit

Permalink
test: 🚨 update golden test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbarsukov committed Jun 19, 2024
1 parent 2ff86ce commit bf48a87
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/golden_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import pytest
import src.machine.main as machine
import src.translator as translator
import src.translator.main as translator


@pytest.mark.golden_test("golden/*.yml")
Expand All @@ -25,15 +25,15 @@ def test_translator_and_machine(golden, caplog):
f.write(golden["in_stdin"])

with contextlib.redirect_stdout(io.StringIO()) as stdout:
translator.main(source, target_data, target_code)
translator.main(source, target_code, target_data)
print("============================================================")
machine(target_code, target_data, input_stream)
machine.main(target_code, target_data, input_stream)

with open(target_code, mode="rb") as f:
code = str(f.read(), encoding="utf-8")
with open(target_code, encoding="utf-8") as f:
code = f.read()

with open(target_data, mode="rb") as f:
data = str(f.read(), encoding="utf-8")
with open(target_data, encoding="utf-8") as f:
data = f.read()

assert data == golden.out["out_data"]
assert code == golden.out["out_code"]
Expand Down

0 comments on commit bf48a87

Please sign in to comment.