mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-10-13 17:49:25 +00:00
Approved the 30 day fixture output as-is so there is a baseline before refactoring. Conjured Mana Cake is still wrong here, that changes later. The approval test was also crashing with "no reporter configuration" instead of showing a diff. pytest-approvaltests 0.2.4 doesn't work with approvaltests 19, so pass PythonNativeReporter directly.
30 lines
750 B
Python
30 lines
750 B
Python
import io
|
|
import sys
|
|
|
|
from approvaltests import Options, verify
|
|
from approvaltests.reporters import PythonNativeReporter
|
|
|
|
from texttest_fixture import main
|
|
|
|
# Print the diff to stdout on a mismatch rather than launching a GUI diff tool,
|
|
# so the test behaves identically locally, headless and in CI.
|
|
REPORTER = PythonNativeReporter()
|
|
|
|
|
|
def test_gilded_rose_approvals():
|
|
orig_sysout = sys.stdout
|
|
try:
|
|
fake_stdout = io.StringIO()
|
|
sys.stdout = fake_stdout
|
|
sys.argv = ["texttest_fixture.py", 30]
|
|
main()
|
|
answer = fake_stdout.getvalue()
|
|
finally:
|
|
sys.stdout = orig_sysout
|
|
|
|
verify(answer, options=Options().with_reporter(REPORTER))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test_gilded_rose_approvals()
|