Skip to content

Commit 09580f9

Browse files
committed
Update metadata
1 parent 003f9a0 commit 09580f9

2 files changed

Lines changed: 69 additions & 7 deletions

File tree

README.md

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,68 @@
1-
# tmc-python3-utils
1+
# tmc-python-tester
22

33
[![Build Status](https://travis-ci.org/rage/tmc-python3-utils.svg?branch=master)](https://travis-ci.org/rage/tmc-python3-utils)
4+
5+
A unittest-based test runner that [tmc-langs](https://github.com/rage/tmc-langs) 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.
6+
7+
## Usage
8+
9+
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:
10+
11+
```python
12+
import unittest
13+
from tmc import points
14+
15+
16+
class TestSomething(unittest.TestCase):
17+
18+
@points('1.1')
19+
def test_something(self):
20+
self.assertEqual('a', 'a')
21+
22+
if __name__ == '__main__':
23+
unittest.main()
24+
```
25+
26+
See the [test resources](test/resources/) folder for more examples.
27+
28+
### Running the tests
29+
30+
To run the tests, execute:
31+
32+
```shell
33+
$ python -m tmc
34+
```
35+
36+
Now `.tmc_test_results.json` will contain the test results:
37+
38+
```json
39+
[
40+
{
41+
"backtrace": [],
42+
"message": "",
43+
"name": "test_something.TestSomething.test_something",
44+
"points": [
45+
"1.1"
46+
],
47+
"status": "passed"
48+
}
49+
]
50+
```
51+
52+
### Available points
53+
54+
One can check what points are available by running:
55+
56+
```shell
57+
$ python -m tmc available_points
58+
```
59+
60+
Then `.available_points.json` has all the points:
61+
62+
```json
63+
{
64+
"test_something.TestSomething.test_something": [
65+
"1.1"
66+
]
67+
}
68+
```

setup.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
from setuptools import setup, find_packages
2-
from distutils.util import convert_path
1+
from setuptools import setup
32

43
setup(
5-
name='tmc-python3-utils',
4+
name='tmc-python-tester',
65
version='0.0.1',
76
author='Joni Salmi <josalmi@cs.helsinki.fi>, ' +
87
'Henrik Nygren <nygrenh@gmail.com>, ' +
@@ -12,7 +11,7 @@
1211
license='BSD',
1312
platforms=['Any'],
1413
keywords=[
15-
'pyunit', 'unittest', 'junit xml', 'report', 'testrunner', 'xmlrunner'
14+
'unittest', 'testrunner', 'tmc', 'tmc-langs', 'points', 'json'
1615
],
1716
url='http://github.com/rage/tmc-python3-utils/tree/master/',
1817
zip_safe=False,
@@ -24,5 +23,3 @@
2423
]
2524
}
2625
)
27-
'
28-
'

0 commit comments

Comments
 (0)