-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Feature: Automatic generation of test code #1650
Closed
Closed
Changes from all commits
Commits
Show all changes
113 commits
Select commit
Hold shift + click to select a range
8323a66
added autotest files
Alireza-Iranpour f431e99
Merge branch 'autotest' of https://github.com/UBC-DSCI/nbgrader into …
Alireza-Iranpour 38bd011
Merge branch 'autotest' of https://github.com/UBC-DSCI/nbgrader into …
Alireza-Iranpour 42b1133
added AutoTest sample problem set and tests.yml
Alireza-Iranpour 8feca53
added PyYAML to requirements.txt
Alireza-Iranpour a730aaf
updated instantiatetests to reflect the latest changes in nbgrader
Alireza-Iranpour a6a1d71
Create problem3.ipynb
Alireza-Iranpour b7c56f9
Update instantiate_tests.py
Alireza-Iranpour 3e6e6b0
added initial commit of R notebook example
trevorcampbell ceeefec
added test support for R
Alireza-Iranpour a0d003f
Fixed the issue regarding the kernel_name identified in the nbgrader …
Alireza-Iranpour 75a9ac9
Merge branch 'jupyter:main' into autotest
trevorcampbell 98c7ad0
added tests for instantiatetests preprocessor
Alireza-Iranpour 1f83e9a
Merge branch 'jupyter:main' into autotest
trevorcampbell 5ad7555
Update limittestcellheights.py
Alireza-Iranpour fe2e7fe
added tests
Alireza-Iranpour 520d4e8
Update tests.yml
Alireza-Iranpour 7cf9b31
Update tests.yml
Alireza-Iranpour b9d2283
Update tests.yml
Alireza-Iranpour d703e8f
Update tests.yml
Alireza-Iranpour 203fd96
modifying the instantiatetests app/converter to remove generate_assig…
trevorcampbell 593b9d8
fixed apps/api to remove old generate_assignment stuff
trevorcampbell aa423f8
minor ed
trevorcampbell bb8720f
minor ed to doc
trevorcampbell 7c556b7
removed old r test yml
trevorcampbell 1494175
instantiated both test notebooks in user guide; clarified tests yml w…
trevorcampbell 9511da7
added R stub to clearsolns; instantiated/released all notebooks in us…
trevorcampbell c0fba44
removed pyyaml from reqmts.txt
trevorcampbell 0654354
add pyyaml to setup.cfg
trevorcampbell 7593403
added jupyter images to docs notebooks
trevorcampbell 441b5f7
added limit test cell heights to nbextension tests
trevorcampbell d5ae9be
made instantiatetests preproc not run / avoid starting kernel if no a…
trevorcampbell 6018e07
reinstantiated/generated notebooks in user_guide after jupyter.png copy
trevorcampbell 846522f
remove copy/pasted deprecation test for instantiate_tests
trevorcampbell 502e54e
removed cell save db check; not used for instantiate tests
trevorcampbell c9f0b84
removed db interaction from instantiate_tests converter; removed/modi…
trevorcampbell c0d65ed
minor bugfix in instantiate_tests test
trevorcampbell efc4d58
minor bugfix instantiate_tests tests
trevorcampbell 0e9c09d
added checkcellmetadata preproc to instantiate_tests converter
trevorcampbell b5cce35
package import fix
trevorcampbell 432f176
remove ps2/ps3 demo assignments from formgrader tests
trevorcampbell bd734cb
fixed limit test cell height tests (css selector was wrong)
trevorcampbell a8be0a8
fix check metadata test for instantiate_tests
trevorcampbell 068ffce
fixed json errors in new test nb
trevorcampbell ef2820a
added tests.yml to tests folder; added a default tests and specific t…
trevorcampbell 5e18afe
removed specific test (should just be a separate test later on); fixe…
trevorcampbell b0a0ceb
removed unused options from instantiatetestsapp
trevorcampbell 7a55f96
added 'python' kernel to test tests.yml
trevorcampbell 8d7c3e7
added disable checkmetadata to instantiatetests no-metadata
trevorcampbell c10aca6
bugfix in instantiatetests app -- returned none instead of nb, resources
trevorcampbell 2bdf242
added traitlets for comment_strs and sanitizers to instantiatetests p…
trevorcampbell 015171b
working on more comprehensive autotest test code
trevorcampbell 8212393
implemented a number of tests for generate_assignment and instantiate…
trevorcampbell 7804654
fixed gen_asgn -> instant_tests in test code
trevorcampbell d682764
minor ed
trevorcampbell c125aa9
minor spacing bugfix instantiate tests
trevorcampbell 35ad594
minor bugfix in test code (filenames)
trevorcampbell 56500f9
copied tests.yml into genfeedback tests
trevorcampbell bfc26b5
removed first cell run (seems redundant...WIP)
trevorcampbell a97686f
bugfix: added run of trailing non-autotest code lines in test cells
trevorcampbell 70027df
removed execution metainfo after instantiatetests
trevorcampbell 1e489bb
minor test bugfix
trevorcampbell a0518ca
simplified multi autotest notebook
trevorcampbell 7bd9619
simplified tests.yml behavior for dicts to use sets instead of sorted…
trevorcampbell 10e473c
reverted autotest-multi book to use lists/dicts with different types
trevorcampbell 42b69a4
tests.yml using sorted string lists instead of sets (to avoid nonhash…
trevorcampbell 2446b36
split autotest multi tests into multiple cells
trevorcampbell 85f5019
fixed minor message flaw in tests.yml
trevorcampbell aff7af5
changed list comp in tests.yml to map to avoid temp variables collidi…
trevorcampbell 79e850c
bugfix: escaping double quotes in failure messages autotest
trevorcampbell eac75b3
added autograding tests for autotest notebooks
trevorcampbell 49e1ee5
added right/wrong changed nbs for hidden autotests
trevorcampbell 61b9adb
minor tests bugfix in hidden tests autograding autotest
trevorcampbell 475f537
more minor bugfix in hidden tests autotest code
trevorcampbell aa3c020
added python kernel to tests.yml
trevorcampbell cb70ebf
Merge branch 'jupyter:main' into autotest
trevorcampbell 0e93295
fleshing out preproc tests for instantiate_tests
trevorcampbell 567ac05
minor ed
trevorcampbell bc6bbb2
removed create option from apps/api.py instantiate_tests
trevorcampbell f07a5fa
Added CodeExecutionError() to raise an exception when there is a prob…
Alireza-Iranpour ce46b0c
Implemented additional tests
Alireza-Iranpour fb85dd9
removed test_no_remove_autotest_nongrade from the tests
Alireza-Iranpour 1916fed
Added generate_source_with_tests flag to the GenerateAssignmentApp
Alireza-Iranpour 0a7e523
Added code to copy the tests.yml file in the quickstartapp
Alireza-Iranpour 30dae71
renamed instantiated_directory to source_with_tests_directory
Alireza-Iranpour 02adbe3
renamed instantiated_directory to source_with_tests_directory
Alireza-Iranpour 56b2f26
Added documentation for the autotes feature (tests-cell-automatic-tes…
Alireza-Iranpour c29d72f
added autotest images to be used in the documentation
Alireza-Iranpour b498f23
Organized user_guide directories
Alireza-Iranpour 6e77364
Changed PyYAML==6.0 to PyYAML>=6.0
Alireza-Iranpour 984a73e
Removed template comments
Alireza-Iranpour f5b7371
Removed instantiatetestsapp
Alireza-Iranpour 077ed64
Removed limit test cell height files from this branch and moved it to…
Alireza-Iranpour 7583e0e
Removed InstantiateTestsApp
Alireza-Iranpour 0c45fed
Merge branch 'jupyter:main' into autotest
Alireza-Iranpour 3ac334c
Merge branch 'autotest' of https://github.com/UBC-DSCI/nbgrader into …
Alireza-Iranpour 61cd35a
Update creating_and_grading_assignments.ipynb
Alireza-Iranpour d15d26a
modifications as a result of running python tasks.py docs
Alireza-Iranpour 9d0063c
Generated release and source_with_tests notebooks for ps2 (R problem …
Alireza-Iranpour c79c92f
Added DataFrame comparison tests to tests.yml
Alireza-Iranpour cfc3a19
Update requirements.txt
Alireza-Iranpour 15e94ae
Merge branch 'jupyter:main' into autotest
Alireza-Iranpour 6505031
Added dictionary tests to ps1/pronlem3.ipynb
Alireza-Iranpour bb0fb3c
Update tests.yml
Alireza-Iranpour 9f479dd
Added the test for setting the flag --generate_source_with_tests
Alireza-Iranpour c77d109
Delete main.js
Alireza-Iranpour 90ec761
Removed limit_cell_height extension
Alireza-Iranpour 862f517
replaced problem1 and 2 in the release folder with the original from …
Alireza-Iranpour 66411bd
removed setup.cfg and added pyyaml to pyproject.toml; merge conflict …
trevorcampbell 8587b95
Delete limited_test_cell_height.ipynb
Alireza-Iranpour e44c2c1
Fixed the test_nbextension_linux
Alireza-Iranpour 7d05c08
Fixed extension related tests
Alireza-Iranpour 2e22e64
Fixed path issue when copying tests.yml file into the course director…
Alireza-Iranpour File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -111,6 +111,7 @@ class NbGraderApp(NbGrader): | |
""" | ||
).strip() | ||
), | ||
|
||
autograde=( | ||
AutogradeApp, | ||
dedent( | ||
|
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import os | ||
import re | ||
from textwrap import dedent | ||
|
||
from traitlets import List, Bool, default | ||
|
||
from ..api import Gradebook, MissingEntry | ||
from .base import BaseConverter, NbGraderException | ||
from ..preprocessors import ( | ||
InstantiateTests, | ||
ClearOutput, | ||
CheckCellMetadata | ||
) | ||
from traitlets.config.loader import Config | ||
from typing import Any | ||
from ..coursedir import CourseDirectory | ||
|
||
|
||
class InstantiateTests(BaseConverter): | ||
|
||
@default("permissions") | ||
def _permissions_default(self) -> int: | ||
return 664 if self.coursedir.groupshared else 644 | ||
|
||
@property | ||
def _input_directory(self) -> str: | ||
return self.coursedir.source_directory | ||
|
||
@property | ||
def _output_directory(self) -> str: | ||
return self.coursedir.source_with_tests_directory | ||
|
||
preprocessors = List([ | ||
InstantiateTests, | ||
ClearOutput, | ||
CheckCellMetadata, | ||
]).tag(config=True) | ||
|
||
def _load_config(self, cfg: Config, **kwargs: Any) -> None: | ||
super(InstantiateTests, self)._load_config(cfg, **kwargs) | ||
|
||
def __init__(self, coursedir: CourseDirectory = None, **kwargs: Any) -> None: | ||
super(InstantiateTests, self).__init__(coursedir=coursedir, **kwargs) | ||
|
||
def start(self) -> None: | ||
old_student_id = self.coursedir.student_id | ||
self.coursedir.student_id = '.' | ||
try: | ||
super(InstantiateTests, self).start() | ||
finally: | ||
self.coursedir.student_id = old_student_id |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This help string seems wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Help sting is fixed
source_with_tests_directory = Unicode( 'source_with_tests', help=dedent( """ The name of the directory that contains the version of the assignment that will contain both the solutions and the instantiated test cases to be used by instructors. This corresponds to the
nbgrader_stepvariable in the
directory_structureconfig option. """ ) ).tag(config=True)