gradema.test._python

Module Contents

Functions

create_python_test(→ gradema.test.Test)

Creates a python test that runs the given module and is successful depending on the successful exit code of running the given module.

create_python_pytest(→ gradema.test.Test)

Creates a pytest test.

create_python_stdio_test(→ gradema.test.Test)

create_python_traditional_stdio_test(→ gradema.test.Test)

Creates a traditional stdio test

create_python_traditional_arg_test(→ gradema.test.Test)

create_python_format_check_from_path(→ gradema.test.Test)

create_python_format_check(→ gradema.test.Test)

create_python_type_check(→ gradema.test.Test)

create_mypy_command(→ gradema.test.Test)

gradema.test._python.create_python_test(module_name: str) gradema.test.Test

Creates a python test that runs the given module and is successful depending on the successful exit code of running the given module.

Please note that this kind of test is susceptible to “early exit attacks”. Details here: https://gradema.readthedocs.io/en/latest/develop/assignment/security.html#early-exit-attacks

Parameters:

module_name – The name of the module to run

Returns:

A test whose success is based on the exit code of running the specified module

gradema.test._python.create_python_pytest(file_argument: str) gradema.test.Test

Creates a pytest test.

Currently, does not have a debugging option. See source code of this function for detailed comment.

Parameters:

file_argument – The argument to pass to pytest that is the file and optionally has a ::test_function_name tacked on at the end

Returns:

A pytest test

gradema.test._python.create_python_stdio_test(module_name: str, test_identifier: str, args: Sequence[gradema.test.argument.Argument], input_file: pathlib.Path | None, goal_file: pathlib.Path, stdout_as_output: bool) gradema.test.Test
gradema.test._python.create_python_traditional_stdio_test(module_name: str, test_identifier: str, input_file: pathlib.Path, goal_file: pathlib.Path) gradema.test.Test

Creates a traditional stdio test

Parameters:
  • module_name

  • test_identifier

  • input_file

  • goal_file

Returns:

gradema.test._python.create_python_traditional_arg_test(module_name: str, test_identifier: str, args: Sequence[gradema.test.argument.Argument], goal_file: pathlib.Path) gradema.test.Test
gradema.test._python.create_python_format_check_from_path(path: str) gradema.test.Test
gradema.test._python.create_python_format_check() gradema.test.Test
gradema.test._python.create_python_type_check() gradema.test.Test
gradema.test._python.create_mypy_command(arguments: Sequence[str]) gradema.test.Test