'Because testing should help, not constrain.'
-
Source code:
my_bugged_module.py
def my_bugged_function(): my_var = {'a': 'b'} 1/0
-
Test case:
test.py
from logging import getLogger from my_bugged_module import my_bugged_function from unittest import TestCase class MyTestCase(TestCase): def test(self): """ Test example. """ print("Print something") getLogger().info("Log message") my_bugged_function()
-
Result:
nosetests --with-html-test test