Skip to content

Commit 2e67d12

Browse files
committed
tests: test behavior with unittest.SkipTest
Ref: #772
1 parent 2793670 commit 2e67d12

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Diff for: tests/test_unittest.py

+33
Original file line numberDiff line numberDiff line change
@@ -487,3 +487,36 @@ def test_method(self):
487487
result = django_testdir.runpytest_subprocess("--pdb")
488488
result.stdout.fnmatch_lines(["*= 2 passed in *"])
489489
assert result.ret == 0
490+
491+
492+
def test_cleaning_debug_post_teardown(django_testdir):
493+
p1 = django_testdir.create_test_module(
494+
"""
495+
from unittest import SkipTest
496+
from django.test import TestCase
497+
498+
post_teardown_count = 0
499+
500+
501+
class TestClass1(TestCase):
502+
503+
def _post_teardown(self):
504+
global post_teardown_count
505+
post_teardown_count += 1
506+
507+
def test_1(self):
508+
assert post_teardown_count == 0
509+
raise SkipTest("skipped!")
510+
511+
def test_2(self):
512+
assert post_teardown_count == 1
513+
"""
514+
)
515+
516+
result = django_testdir.runpytest_subprocess(
517+
"--pdb",
518+
"{}::TestClass1::test_1".format(p1),
519+
"{}::TestClass1::test_2".format(p1),
520+
)
521+
result.stdout.fnmatch_lines(["*= 1 passed, 1 skipped in *"])
522+
assert result.ret == 0

0 commit comments

Comments
 (0)