Skip to content

Commit

Permalink
added autotests flag test to quickstart tests
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorcampbell committed Aug 29, 2023
1 parent 0ca7287 commit 72b2653
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions nbgrader/tests/apps/test_nbgrader_quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,28 @@ def test_quickstart_f(self):

# nbgrader generate_assignment should work
run_nbgrader(["generate_assignment", "ps1"])

def test_quickstart_autotest(self):
"""Is the quickstart example with autotests properly generated?"""

run_nbgrader(["quickstart", "example", "--autotest"])

# it should fail if it already exists
run_nbgrader(["quickstart", "example", "--autotest"], retcode=1)

# it should succeed if --force is given
os.remove(os.path.join("example", "nbgrader_config.py"))
run_nbgrader(["quickstart", "example", "--force", "--autotest"])
assert os.path.exists(os.path.join("example", "nbgrader_config.py"))
assert os.path.exists(os.path.join("example", "autotests.yml"))

# nbgrader validate should work
os.chdir("example")
for nb in os.listdir(os.path.join("source", "ps1")):
if not nb.endswith(".ipynb"):
continue
output = run_nbgrader(["validate", os.path.join("source", "ps1", nb)], stdout=True)
assert output.strip() == "Success! Your notebook passes all the tests."

# nbgrader generate_assignment should work
run_nbgrader(["generate_assignment", "ps1"])

0 comments on commit 72b2653

Please sign in to comment.