-
Notifications
You must be signed in to change notification settings - Fork 268
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #175 from cs50/develop
v.3.0.6
- Loading branch information
Showing
13 changed files
with
78 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
recursive-include check50/locale * | ||
graft check50/renderer/static | ||
graft check50/renderer/templates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ def _setup_translation(): | |
include, | ||
run, | ||
log, _log, | ||
hidden, | ||
Failure, Mismatch | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from ._renderers import to_ansi, to_html, to_json, from_json | ||
from ._renderers import to_ansi, to_html, to_json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,15 +80,13 @@ def _handle_timeout(*args): | |
signal.signal(signal.SIGALRM, signal.SIG_DFL) | ||
|
||
|
||
def check(dependency=None, timeout=60, hidden=False): | ||
def check(dependency=None, timeout=60): | ||
"""Mark function as a check. | ||
:param dependency: the check that this check depends on | ||
:type dependency: function | ||
:param timeout: maximum number of seconds the check can run | ||
:type timeout: int | ||
:param hidden: true if cause and log should be hidden from student | ||
:type hidden: bool | ||
When a check depends on another, the former will only run if the latter passes. | ||
Additionally, the dependent check will inherit the filesystem of its dependency. | ||
|
@@ -144,7 +142,7 @@ def wrapper(checks_root, dependency_state): | |
state = check(*args) | ||
except Failure as e: | ||
result.passed = False | ||
result.cause = e.payload if not hidden else {} | ||
result.cause = e.payload | ||
except BaseException as e: | ||
result.passed = None | ||
result.cause = {"rationale": _("check50 ran into an error while running checks!"), | ||
|
@@ -154,16 +152,10 @@ def wrapper(checks_root, dependency_state): | |
"traceback": traceback.format_tb(e.__traceback__), | ||
"data" : e.payload if hasattr(e, "payload") else {} | ||
}} | ||
|
||
# log(repr(e)) | ||
# for line in traceback.format_tb(e.__traceback__): | ||
# log(line.rstrip()) | ||
# log(_("Contact [email protected] with the slug of this check!")) | ||
else: | ||
result.passed = True | ||
finally: | ||
if not hidden: | ||
result.log = _log | ||
result.log = _log | ||
result.data = _data | ||
return result, state | ||
return wrapper | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import check50 | ||
|
||
@check50.check(hidden=True) | ||
@check50.check() | ||
@check50.hidden("foo") | ||
def check(): | ||
check50.log("AHHHHHHHHHHHHHHHHHHH") | ||
raise check50.Failure("AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH") |