Commit a0e63213 authored by Alan Marchiori's avatar Alan Marchiori
Browse files

remove leading/trailing spaces, and other improvements.

parent a76118e4
......@@ -119,6 +119,7 @@ class Checker:
if 'on_error' in check:
error(check['on_error'])
error(t)
else:
error("{}: failed! Expected return code {} but got {}.".format(msg, check['returncode'], c))
error(t)
......@@ -133,7 +134,9 @@ class Checker:
else:
warn("Rubric has non-string stdout!")
x = str(check['stdout'])
results += [t == x]
# ignore leading/trailing whitespaces (strip)
results += [t.strip() == x.strip()]
if results[-1]:
success("{}: Output passed.".format(msg))
else:
......@@ -147,9 +150,9 @@ class Checker:
error(check['on_error'])
else:
error("{}: Output not as expected (check formatting!)".format(msg))
for line in difflib.context_diff(
x.split("\n"), t.split("\n"),
x.strip().split("\n"), t.strip().split("\n"),
fromfile='Expected output',
tofile='Your output'):
echo(line.strip())
......
......@@ -32,11 +32,9 @@ import contextlib # to redirect stdout
help='Regrade a previously graded item?\t[default: False]')
@click.option("--user", default=None,
help='Set to only grade a single user (by git username).\t[default: ALL]')
@click.option("--feedback", default="feedback.txt",
help='File to write feedback to.')
@click.option("--push/--no-push", default = True, show_default=True,
help='Push commits to gitlab?')
def grade(lab, part, clone, dograde, regrade, user, feedback, push):
def grade(lab, part, clone, dograde, regrade, user, push):
"""grade LAB and PART for students from gitlab. LAB is required. If PART is omitted, ALL parts are graded.
"""
......
......@@ -36,7 +36,7 @@ smtp_handler = logging.handlers.SMTPHandler(
subject=u"labtool crash report!")
__version__ = '1.0.9'
__date__ = '2020-02-11T12:03:51.878974'
__date__ = '2020-02-12T20:39:09.919446'
__user__ = 'cs206'
__host__ = 'linuxremote3.bucknell.edu'
@click.group()
......
import os
import os.path
import json
import sys
from config.echo import debug, error
class History(dict):
"""A simple class to store grade history.
......@@ -48,7 +49,7 @@ class History(dict):
self.update(d)
except Exception as x:
print(x)
exit()
sys.exit()
return self
def __exit__(self, type, value, traceback):
"save history"
......
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