Skip to content
Tianshu Huang edited this page Dec 3, 2018 · 1 revision

Tester

Running tests

Simply run

python tests.py

from the main r5-2019 directory.

Adding modules to the tester

At the bottom of tests.py, add the module as an import and to the list passed to run_tests:

import control
import your_new_module

run_tests([control, your_new_module])

Adding tests

Add tests by adding a unittest.TestCase class to any file imported by your module. This class should then contain methods that start with test, which will be run. For example:

class Tests(unittest.TestCase):
    def test_foo(self):
        self.assertEqual(run_test_function(1), 0)
        self.assertTrue(1 == 1)
        self.assertFalse(1 == 2)

Clone this wiki locally