2 года назад
История
README.md
Simple Test
Python library for writing simple tests
version 0.1.0
Using
file test.py:
import time
def test_plus():
time.sleep(1)
assert 2 + 2 == 4
def test_minus():
assert 2 - 2 == 0
def test_mult():
assert 2 * 1 == 4 # Test AssertionError
def test_div():
assert 2 / 0 == 1 # Test other exception
file main.py:
import simple_test
simple_test.run('test.py')
running program:
$ python main.py
tests: 4
==================================================
test 'test_div' [1/4]... ERROR
Traceback (most recent call last):
File "/media/home/nick/Python/simple_test/simple_test/_run.py", line 17, in run
func()
File "/media/home/nick/Python/simple_test/test.py", line 18, in test_div
assert 2 / 0 == 1 # Test other exception
ZeroDivisionError: division by zero
test 'test_minus' [2/4]... OK
test 'test_mult' [3/4]... FAILED
Traceback (most recent call last):
File "/media/home/nick/Python/simple_test/simple_test/_run.py", line 17, in run
func()
File "/media/home/nick/Python/simple_test/test.py", line 14, in test_mult
assert 2 * 1 == 4 # Test AssertionError
AssertionError
test 'test_plus' [4/4]... OK
==================================================
passed tests: 2
failed tests: 2
That’s all
It’s really simple!
Конвейеры
0 успешных
0 с ошибкой