本文整理汇总了Python中nbgrader.tests.run_command函数的典型用法代码示例。如果您正苦于以下问题:Python run_command函数的具体用法?Python run_command怎么用?Python run_command使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run_command函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_force
def test_force(self, gradebook):
"""Ensure the force option works properly"""
self._copy_file("files/submitted-unchanged.ipynb", "source/ps1/p1.ipynb")
self._make_file("source/ps1/foo.txt", "foo")
self._make_file("source/ps1/data/bar.txt", "bar")
run_command('nbgrader assign ps1 --db="{}" '.format(gradebook))
self._copy_file("files/submitted-unchanged.ipynb", "submitted/foo/ps1/p1.ipynb")
self._make_file("submitted/foo/ps1/foo.txt", "foo")
self._make_file("submitted/foo/ps1/data/bar.txt", "bar")
self._make_file("submitted/foo/ps1/blah.pyc", "asdf")
run_command('nbgrader autograde ps1 --db="{}"'.format(gradebook))
assert os.path.isfile("autograded/foo/ps1/p1.ipynb")
assert os.path.isfile("autograded/foo/ps1/foo.txt")
assert os.path.isfile("autograded/foo/ps1/data/bar.txt")
assert not os.path.isfile("autograded/foo/ps1/blah.pyc")
# check that it skips the existing directory
os.remove("autograded/foo/ps1/foo.txt")
run_command('nbgrader autograde ps1 --db="{}"'.format(gradebook))
assert not os.path.isfile("autograded/foo/ps1/foo.txt")
# force overwrite the supplemental files
run_command('nbgrader autograde ps1 --db="{}" --force'.format(gradebook))
assert os.path.isfile("autograded/foo/ps1/foo.txt")
# force overwrite
os.remove("source/ps1/foo.txt")
os.remove("submitted/foo/ps1/foo.txt")
run_command('nbgrader autograde ps1 --db="{}" --force'.format(gradebook))
assert os.path.isfile("autograded/foo/ps1/p1.ipynb")
assert not os.path.isfile("autograded/foo/ps1/foo.txt")
assert os.path.isfile("autograded/foo/ps1/data/bar.txt")
assert not os.path.isfile("autograded/foo/ps1/blah.pyc")
开发者ID:svurens,项目名称:nbgrader,代码行数:35,代码来源:test_nbgrader_autograde.py
示例2: test_install_user
def test_install_user(self, temp_dir):
nbextension_dir = os.path.join(temp_dir, "nbextensions")
run_command(["nbgrader", "extension", "install", "--nbextensions", nbextension_dir])
# check the extension file were copied
assert os.path.isfile(os.path.join(nbextension_dir, "nbgrader", "create_assignment.js"))
assert os.path.isfile(os.path.join(nbextension_dir, "nbgrader", "nbgrader.css"))
开发者ID:c0ns0le,项目名称:nbgrader,代码行数:7,代码来源:test_nbgrader_extension.py
示例3: test_missing_assignment
def test_missing_assignment(self, gradebook):
"""Is an error thrown when the assignment is missing?"""
self._copy_file("files/submitted-changed.ipynb", "source/ps1/p1.ipynb")
run_command('nbgrader assign ps1 --db="{}" '.format(gradebook))
self._copy_file("files/submitted-changed.ipynb", "submitted/ps2/foo/p1.ipynb")
run_command('nbgrader autograde ps2 --db="{}" '.format(gradebook), retcode=1)
开发者ID:svurens,项目名称:nbgrader,代码行数:7,代码来源:test_nbgrader_autograde.py
示例4: test_install_system
def test_install_system(self, temp_dir):
run_command(["nbgrader", "extension", "install", "--prefix", temp_dir])
# check the extension file were copied
nbextension_dir = os.path.join(temp_dir, "share", "jupyter", "nbextensions", "nbgrader")
assert os.path.isfile(os.path.join(nbextension_dir, "create_assignment.js"))
assert os.path.isfile(os.path.join(nbextension_dir, "nbgrader.css"))
开发者ID:c0ns0le,项目名称:nbgrader,代码行数:7,代码来源:test_nbgrader_extension.py
示例5: _release
def _release(self, assignment, exchange):
self._copy_file("files/test.ipynb", "release/ps1/p1.ipynb")
run_command([
"nbgrader", "release", assignment,
"--NbGraderConfig.course_id=abc101",
"--TransferApp.exchange_directory={}".format(exchange)
])
开发者ID:gustavoasoares,项目名称:nbgrader,代码行数:7,代码来源:test_nbgrader_fetch.py
示例6: test_no_course_id
def test_no_course_id(self, exchange):
"""Does releasing without a course id thrown an error?"""
cmd = [
"nbgrader", "release", "ps1",
"--TransferApp.exchange_directory={}".format(exchange)
]
run_command(cmd, retcode=1)
开发者ID:c0ns0le,项目名称:nbgrader,代码行数:7,代码来源:test_nbgrader_release.py
示例7: test_install_user
def test_install_user(self, temp_dir):
nbextension_dir = os.path.join(temp_dir, "nbextensions")
run_command("nbgrader extension install --nbextensions={}".format(nbextension_dir))
# check the extension file were copied
assert os.path.isfile(os.path.join(nbextension_dir, "nbgrader", "create_assignment.js"))
assert os.path.isfile(os.path.join(nbextension_dir, "nbgrader", "nbgrader.css"))
开发者ID:haraldschilly,项目名称:nbgrader,代码行数:7,代码来源:test_nbgrader_extension.py
示例8: gradebook
def gradebook(request, tempdir):
# create a "class files" directory
origdir = os.getcwd()
os.mkdir("class_files")
os.chdir("class_files")
# copy files from the user guide
source_path = os.path.join(os.path.dirname(__file__), "..", "..", "..", "docs", "source", "user_guide", "source")
submitted_path = os.path.join(os.path.dirname(__file__), "..", "..", "..", "docs", "source", "user_guide", "submitted")
shutil.copytree(os.path.join(os.path.dirname(__file__), source_path), "source")
shutil.copytree(os.path.join(os.path.dirname(__file__), submitted_path), "submitted")
# create the gradebook
gb = Gradebook("sqlite:///gradebook.db")
gb.add_assignment("Problem Set 1")
gb.add_student("Bitdiddle", first_name="Ben", last_name="B")
gb.add_student("Hacker", first_name="Alyssa", last_name="H")
gb.add_student("Reasoner", first_name="Louis", last_name="R")
# run nbgrader assign
run_command([
"nbgrader", "assign", "Problem Set 1",
"--IncludeHeaderFooter.header=source/header.ipynb"
])
# run the autograder
run_command(["nbgrader", "autograde", "Problem Set 1"])
def fin():
os.chdir(origdir)
shutil.rmtree("class_files")
request.addfinalizer(fin)
return gb
开发者ID:MatKallada,项目名称:nbgrader,代码行数:35,代码来源:conftest.py
示例9: _release
def _release(self, assignment, exchange, flags="", retcode=0):
run_command(
'nbgrader release {} '
'--NbGraderConfig.course_id=abc101 '
'--TransferApp.exchange_directory={} '
'{}'.format(assignment, exchange, flags),
retcode=retcode)
开发者ID:haraldschilly,项目名称:nbgrader,代码行数:7,代码来源:test_nbgrader_release.py
示例10: test_multiple_files
def test_multiple_files(self):
"""Can multiple files be assigned?"""
self._empty_notebook('source/ps1/foo.ipynb')
self._empty_notebook('source/ps1/bar.ipynb')
run_command("nbgrader assign ps1 --create")
assert os.path.isfile("release/ps1/foo.ipynb")
assert os.path.isfile("release/ps1/bar.ipynb")
开发者ID:haraldschilly,项目名称:nbgrader,代码行数:7,代码来源:test_nbgrader_assign.py
示例11: test_missing_assignment
def test_missing_assignment(self, gradebook):
"""Is an error thrown when the assignment is missing?"""
self._copy_file("files/submitted-changed.ipynb", "source/ps1/p1.ipynb")
run_command(["nbgrader", "assign", "ps1", "--db", gradebook])
self._copy_file("files/submitted-changed.ipynb", "submitted/ps2/foo/p1.ipynb")
run_command(["nbgrader", "autograde", "ps2", "--db", gradebook], retcode=1)
开发者ID:vanceeasleaf,项目名称:nbgrader,代码行数:7,代码来源:test_nbgrader_autograde.py
示例12: test_grade
def test_grade(self, gradebook):
"""Can files be graded?"""
self._copy_file("files/submitted-unchanged.ipynb", "source/ps1/p1.ipynb")
run_command('nbgrader assign ps1 --db="{}" '.format(gradebook))
self._copy_file("files/submitted-unchanged.ipynb", "submitted/foo/ps1/p1.ipynb")
self._copy_file("files/submitted-changed.ipynb", "submitted/bar/ps1/p1.ipynb")
run_command('nbgrader autograde ps1 --db="{}"'.format(gradebook))
assert os.path.isfile("autograded/foo/ps1/p1.ipynb")
assert not os.path.isfile("autograded/foo/ps1/timestamp.txt")
assert os.path.isfile("autograded/bar/ps1/p1.ipynb")
assert not os.path.isfile("autograded/bar/ps1/timestamp.txt")
gb = Gradebook(gradebook)
notebook = gb.find_submission_notebook("p1", "ps1", "foo")
assert notebook.score == 1
assert notebook.max_score == 4
assert notebook.needs_manual_grade == False
comment1 = gb.find_comment(0, "p1", "ps1", "foo")
comment2 = gb.find_comment(1, "p1", "ps1", "foo")
assert comment1.comment == "No response."
assert comment2.comment == "No response."
notebook = gb.find_submission_notebook("p1", "ps1", "bar")
assert notebook.score == 2
assert notebook.max_score == 4
assert notebook.needs_manual_grade == True
comment1 = gb.find_comment(0, "p1", "ps1", "bar")
comment2 = gb.find_comment(1, "p1", "ps1", "bar")
assert comment1.comment == None
assert comment2.comment == None
开发者ID:haraldschilly,项目名称:nbgrader,代码行数:34,代码来源:test_nbgrader_autograde.py
示例13: _collect
def _collect(self, assignment, exchange, flags="", retcode=0):
print("Calling collect with assignment: " + assignment)
run_command(
'nbgrader collect {} '
'--NbGraderConfig.course_id=abc101 '
'--TransferApp.exchange_directory={} '
'{}'.format(assignment, exchange, flags),
retcode=retcode)
开发者ID:svurens,项目名称:nbgrader,代码行数:8,代码来源:test_nbgrader_collect.py
示例14: _release_and_fetch
def _release_and_fetch(self, assignment, exchange):
self._copy_file("files/test.ipynb", "release/ps1/p1.ipynb")
run_command(
"nbgrader release {} "
"--NbGraderConfig.course_id=abc101 "
"--TransferApp.exchange_directory={} ".format(assignment, exchange)
)
run_command("nbgrader fetch abc101 {} " "--TransferApp.exchange_directory={} ".format(assignment, exchange))
开发者ID:ellachao,项目名称:nbgrader,代码行数:8,代码来源:test_nbgrader_collect.py
示例15: _collect
def _collect(self, assignment, exchange, flags="", retcode=0):
run_command(
"nbgrader collect {} "
"--NbGraderConfig.course_id=abc101 "
"--TransferApp.exchange_directory={} "
"{}".format(assignment, exchange, flags),
retcode=retcode,
)
开发者ID:ellachao,项目名称:nbgrader,代码行数:8,代码来源:test_nbgrader_collect.py
示例16: test_side_effects
def test_side_effects(self, gradebook):
self._copy_file("files/side-effects.ipynb", "source/ps1/p1.ipynb")
run_command(["nbgrader", "assign", "ps1", "--db", gradebook])
self._copy_file("files/side-effects.ipynb", "submitted/foo/ps1/p1.ipynb")
run_command(["nbgrader", "autograde", "ps1", "--db", gradebook])
assert os.path.isfile("autograded/foo/ps1/side-effect.txt")
assert not os.path.isfile("submitted/foo/ps1/side-effect.txt")
开发者ID:vanceeasleaf,项目名称:nbgrader,代码行数:9,代码来源:test_nbgrader_autograde.py
示例17: test_add_missing_student
def test_add_missing_student(self, gradebook):
"""Can a missing student be added?"""
self._copy_file("files/submitted-changed.ipynb", "source/ps1/p1.ipynb")
run_command(["nbgrader", "assign", "ps1", "--db", gradebook])
self._copy_file("files/submitted-changed.ipynb", "submitted/baz/ps1/p1.ipynb")
run_command(["nbgrader", "autograde", "ps1", "--db", gradebook, "--create"])
assert os.path.isfile("autograded/baz/ps1/p1.ipynb")
开发者ID:vanceeasleaf,项目名称:nbgrader,代码行数:9,代码来源:test_nbgrader_autograde.py
示例18: test_add_missing_student
def test_add_missing_student(self, gradebook):
"""Can a missing student be added?"""
self._copy_file("files/submitted-changed.ipynb", "source/ps1/p1.ipynb")
run_command('nbgrader assign ps1 --db="{}" '.format(gradebook))
self._copy_file("files/submitted-changed.ipynb", "submitted/baz/ps1/p1.ipynb")
run_command('nbgrader autograde ps1 --db="{}" --create'.format(gradebook))
assert os.path.isfile("autograded/baz/ps1/p1.ipynb")
开发者ID:svurens,项目名称:nbgrader,代码行数:9,代码来源:test_nbgrader_autograde.py
示例19: test_no_course_id
def test_no_course_id(self, exchange, cache):
"""Does releasing without a course id thrown an error?"""
self._release_and_fetch("ps1", exchange, cache)
cmd = [
"nbgrader", "submit", "ps1",
"--TransferApp.cache_directory={}".format(cache),
"--TransferApp.exchange_directory={}".format(exchange)
]
run_command(cmd, retcode=1)
开发者ID:c0ns0le,项目名称:nbgrader,代码行数:9,代码来源:test_nbgrader_submit.py
示例20: test_side_effects
def test_side_effects(self, gradebook):
self._copy_file("files/side-effects.ipynb", "source/ps1/p1.ipynb")
run_command('nbgrader assign ps1 --db="{}" '.format(gradebook))
self._copy_file("files/side-effects.ipynb", "submitted/foo/ps1/p1.ipynb")
run_command('nbgrader autograde ps1 --db="{}"'.format(gradebook))
assert os.path.isfile("autograded/foo/ps1/side-effect.txt")
assert not os.path.isfile("submitted/foo/ps1/side-effect.txt")
开发者ID:svurens,项目名称:nbgrader,代码行数:9,代码来源:test_nbgrader_autograde.py
注:本文中的nbgrader.tests.run_command函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论