Skip to content

testmycode/tmc-python-tester

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 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:

import unittest
from tmc import points


class TestSomething(unittest.TestCase):

    @points('1.1')
    def test_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

Watchers

Forks

Releases

No releases published

Packages

No packages published