Skip to content

Commit 00cbb31

Browse files
committed
Add more details about configuration (resolves #8)
1 parent da9dcbc commit 00cbb31

File tree

3 files changed

+42
-17
lines changed

3 files changed

+42
-17
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2020
- `assert_not_imported` can also take a string
2121
- `redirect_stdin` also wraps `builtins.input`
2222
- various docstrings and README.md file contents
23+
- instructions about global configuration variables
2324

2425

2526
## [1.4.0] - 2025-10-09

examples/2_basic_input/test_welcome.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
SUBMISSION_FILES = [FILENAME]
1111
AUTOGRADER_TESTS = ["test_welcome.py"]
1212
ADDITIONAL_FILES = []
13+
REQUIREMENTS_TXT = []
1314
SUBMISSION_LIMIT = 10
1415
FUNCTION_TIMEOUT = 2
1516
SCHOOL_TIME_ZONE = "US/Mountain"

examples/README.md

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,49 @@ During autograder setup, a configuration script named [`config.sh`](../jmu_pytes
2222
This script sets the environment variables used by [`run_autograder`](../jmu_pytest_utils/template/run_autograder) and other grading scripts.
2323

2424
You can override the default values in `config.sh` by defining global variables with the same names.
25-
For example, to limit the number of submissions, you can add the following line to your test module (after the `import` statements):
26-
27-
``` py
28-
SUBMISSION_LIMIT = 10
29-
```
30-
31-
Alternatively, you can define environment variables that apply to all assignments.
32-
For example, the default time zone is `US/Eastern`, but if your school is somewhere else, you can set this variable in your OS environment:
33-
34-
``` sh
35-
export SCHOOL_TIME_ZONE="US/Mountain"
36-
```
25+
For example, you can add any of the following lines to your test module after the `import` statements:
26+
27+
* Limit the number of submissions:
28+
``` py
29+
SUBMISSION_LIMIT = 10
30+
```
31+
* Change pytest's --timeout value:
32+
``` py
33+
FUNCTION_TIMEOUT = 10
34+
```
35+
* Specify packages to be installed:
36+
``` py
37+
REQUIREMENTS_TXT = ["beautifulsoup4", "requests"]
38+
```
39+
40+
Alternatively, you can define environment variables that apply to *all* assignments.
41+
For example, you can export these variables before running `jmu_pytest_utils build`:
42+
43+
* Change the submission time zone:
44+
``` sh
45+
export SCHOOL_TIME_ZONE="US/Mountain"
46+
```
47+
* Install a specific python version:
48+
``` sh
49+
export INSTALL_PYTHON_V="3.14"
50+
```
3751

3852
The [`builder.py`](../jmu_pytest_utils/builder.py) script automatically detects assignment files using `os.walk()`.
3953
However, you can manually override the file requirements if needed.
40-
For example, to specify the files that students must submit, add a line like this to your test module:
41-
42-
``` py
43-
SUBMISSION_FILES = ["file1.py", "file2.py"]
44-
```
54+
For example:
55+
56+
* Files the student must submit:
57+
``` py
58+
SUBMISSION_FILES = ["file1.py", "file2.py"]
59+
```
60+
* Reference tests for grading:
61+
``` py
62+
AUTOGRADER_TESTS = ["test_file1.py", "test_file2.py"]
63+
```
64+
* Other files included in zip:
65+
``` py
66+
ADDITIONAL_FILES = ["data/hello.txt", "data/world.txt"]
67+
```
4568

4669
When looking at `config.sh`, note that Bash and Python represent a list of files differently.
4770
Bash uses a space-delimited string (Ex: `"file1.py file2.py"`), but Python uses a list of strings.

0 commit comments

Comments
 (0)