From a6532c897b125c85ee29893dfa0677621d699be8 Mon Sep 17 00:00:00 2001 From: Brian Yu Date: Sun, 1 Oct 2017 01:46:16 -0400 Subject: [PATCH 1/3] Better handle exceptions --- .gitignore | 5 ++++- check50.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 00817960..c40b3374 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ -*.pyc +*.c *.egg-info +*.pyc +*.sb2 dist build __pycache__/ +tmp diff --git a/check50.py b/check50.py index 7f5cb981..e7844df9 100755 --- a/check50.py +++ b/check50.py @@ -354,7 +354,7 @@ def addSuccess(self, test): }) def addError(self, test, err): - test.log.append(err[1]) + test.log.append(str(err[1])) test.log += traceback.format_tb(err[2]) test.log.append("Contact sysadmins@cs50.harvard.edu with the URL of this check!") self.results.append({ From b01538d290003c9d87e459cc3b2ebde6ce5590df Mon Sep 17 00:00:00 2001 From: Brian Yu Date: Sun, 1 Oct 2017 01:47:09 -0400 Subject: [PATCH 2/3] Fix merge conflicts --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 6f1f6001..329ec810 100644 --- a/setup.py +++ b/setup.py @@ -60,5 +60,5 @@ class CustomInstall(install): "console_scripts": ["check50=check50:main"] }, url="https://github.com/cs50/check50", - version="2.1.0" + version="2.1.1" ) From 1aa866a6b1468eb616d3da8c5a45f8db445c9805 Mon Sep 17 00:00:00 2001 From: Brian Yu Date: Mon, 2 Oct 2017 09:53:52 -0400 Subject: [PATCH 3/3] Increase timeouts --- check50.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/check50.py b/check50.py index e7844df9..a72845fd 100755 --- a/check50.py +++ b/check50.py @@ -452,7 +452,7 @@ def __init__(self, test, child): self.output = [] self.exitstatus = None - def stdin(self, line, prompt=True, timeout=1): + def stdin(self, line, prompt=True, timeout=3): if line == EOF: self.test.log.append("sending EOF...") else: @@ -470,7 +470,7 @@ def stdin(self, line, prompt=True, timeout=1): self.child.sendline(line) return self - def stdout(self, output=None, str_output=None, timeout=1): + def stdout(self, output=None, str_output=None, timeout=3): if output is None: return self.wait(timeout).output @@ -512,7 +512,7 @@ def stdout(self, output=None, str_output=None, timeout=1): return self - def reject(self, timeout=1): + def reject(self, timeout=3): self.test.log.append("checking that input was rejected...") try: self.child.expect(".+", timeout=timeout) @@ -525,7 +525,7 @@ def reject(self, timeout=1): raise Error("timed out while waiting for input to be rejected") return self - def exit(self, code=None, timeout=1): + def exit(self, code=None, timeout=5): self.wait(timeout) if code is None: @@ -536,7 +536,7 @@ def exit(self, code=None, timeout=1): raise Error("expected exit code {}, not {}".format(code, self.exitstatus)) return self - def wait(self, timeout=1): + def wait(self, timeout=5): end = time.time() + timeout while time.time() <= end: if not self.child.isalive():