test pidgy
’s interactive testing¶
import pidgy, unittest, IPython, pytest
with pidgy.pidgyLoader(lazy=True):
import pidgy.compat.unittesting
not_a_test = pytest.mark.skip(reason="This is not a real test")
import pidgy, unittest, IPython, pytest
with pidgy.pidgyLoader(lazy=True):
import pidgy.compat.unittesting
not_a_test = pytest.mark.skip(reason="This is not a real test")
def test_true():
assert True
def test_true():
assert True
@not_a_test
def test_false():
assert False
@not_a_test
def test_false():
assert False
Traceback (most recent call last):
File "<ipython-input-3-ee1396f413a8>", line 3, in test_false
assert False
AssertionError
class tester(unittest.TestCase):
def test_true(x):
assert True
@not_a_test
def test_false(x):
assert False
class tester(unittest.TestCase):
def test_true(x):
assert True
@not_a_test
def test_false(x):
assert False
Traceback (most recent call last):
File "<ipython-input-4-bf6bf791fc90>", line 6, in test_false
assert False
AssertionError
def test_suite():
suite = pidgy.testing.Testing(
parent=IPython.get_ipython()
).collect(tester, test_true, test_false, vars=locals(), name=__name__)
assert len(suite._tests) == 3
assert suite.run(unittest.TestResult()).failures
def test_suite():
suite = pidgy.testing.Testing(
parent=IPython.get_ipython()
).collect(tester, test_true, test_false, vars=locals(), name=__name__)
assert len(suite._tests) == 3
assert suite.run(unittest.TestResult()).failures