writing test is important.
cati has a custom testing system. all of tests are in tests/ directory.
to run tests, you have the following ways:
make test
# or
python3 tests/run.py
# or
./tests/run.pytests/run.py script runs tests.
to create new test, you can run this command in terminal:
python3 tests/make_test.py test_somethingthe tests/make_test.py script makes a test. you should pass test name as argument to this script.
now, created test is in tests/items/test_something.py:
""" Test test_something """
from TestCore import TestCore
class test_something(TestCore):
""" Test test_something """
def run(self):
""" Run test """
# this is main function of test. do assertions here
self.assert_true(True)now you can do assertions in run function.
Another TestCore function:
assert_equals(first, last): assert equalsenv(): returns testing environment directory pathrefresh_env(): when you installing/removing... packages in current environment, this action may make conflict for another tests, so, calling this function refreshes environmentrun_command(command_name, [command_arguments]): this function runs command and returns exit code of that