Python: pytest

Running pytest scripts in the codePost autograder

Vinay avatar
Written by Vinay
Updated over a week ago

Environment: 

  • Language: Python 3.7

  • Build Type: Default

  • Packages: pip install pytest; pip install -U pylint

  • Run Script: None

  • Helper Files: Upload your Test script as a helper file

Tests

  1. Open file mode, and click "Add File". Create a new Test File

  2. In your Test File, add the following two commands:

pytest <YourScript>.py

Settings

  • Turn on "dump test outputs to  _tests.txt. This stores the pytest outputs into a file in each student's submissions

  • If you want students to see the output of all tests when they submit, you'll also want to turn on "Expose outputs to students on submit".

Tests

Did this answer your question?