Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

80 Commits

Repository files navigation

tmc-python-tester

Build Status

A unittest-based test runner that tmc-langs and tmc-langs-rust uses to check exercises. Runs tests and ouputs the results in JSON format. Allows one to assign points to individual test cases or classes with @points decorators.

Usage

This test runner accepts standard unittest test cases. One can optionally import and use the @points decorators from the library. A basic decorated test case looks like this:

importunittestfromtmcimportpointsclassTestSomething(unittest.TestCase):
@points('1.1')deftest_something(self):
self.assertEqual('a', 'a')
if__name__=='__main__':
unittest.main()

See the test resources folder for more examples.

Running the tests

To run the tests, execute:

$ python -m tmc

Now .tmc_test_results.json will contain the test results:

[
{
"backtrace": [],
"message": "",
"name": "test_something.TestSomething.test_something",
"passed": true,
"points": [
"1.1"
],
"status": "passed"
}
]

Available points

One can check what points are available by running:

$ python -m tmc available_points

Then .available_points.json has all the points:

{
"test_something.TestSomething.test_something": [
"1.1"
]
}

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

11 watching

Forks

Releases

Packages

Used by

Contributors

Languages