Commit d9896c52 authored by Louis's avatar Louis
Browse files

[cli.test] `pyromaths-cli test update` affiche un diff des fichiers TeX

parent 4bf3b8f7
......@@ -205,6 +205,7 @@ def do_update(options):
test = tests.get(exercise, seed)
if test.changed():
if ask_confirm("Is the test valid?"):
......@@ -27,6 +27,7 @@ does just as expected.
import codecs
import difflib
import gettext
import glob
import logging
......@@ -169,6 +170,28 @@ class TestExercise(object):
return True
return False
def print_diff(self):
"""Print the diff between old and new test."""
exo = self.get_exercise()
if "\n".join(exo.tex_statement()) !='statement'):
for line in difflib.unified_diff('statement'),
fromfile='Old statement',
tofile='New statement',
if "\n".join(exo.tex_answer()) !='answer'):
for line in difflib.unified_diff('answer').splitlines(),
fromfile='Old answer',
tofile='New answer',
class UnittestExercise(unittest.TestCase):
"""Test an exercise, with a particular seed."""
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment