@@ -806,7 +806,11 @@ def test_calls(self, testdir):
806806 result = testdir .runpytest ("--durations=10" )
807807 assert result .ret == 0
808808 result .stdout .fnmatch_lines_random (
809- ["*durations*" , "*call*test_3*" , "*call*test_2*" , "*call*test_1*" ]
809+ ["*durations*" , "*call*test_3*" , "*call*test_2*" ]
810+ )
811+ assert "test_something" not in result .stdout .str ()
812+ result .stdout .fnmatch_lines (
813+ ["(0.00 durations hidden. Use -vv to show these durations.)" ]
810814 )
811815
812816 def test_calls_show_2 (self , testdir ):
@@ -820,6 +824,18 @@ def test_calls_showall(self, testdir):
820824 testdir .makepyfile (self .source )
821825 result = testdir .runpytest ("--durations=0" )
822826 assert result .ret == 0
827+ for x in "23" :
828+ for y in ("call" ,): # 'setup', 'call', 'teardown':
829+ for line in result .stdout .lines :
830+ if ("test_%s" % x ) in line and y in line :
831+ break
832+ else :
833+ raise AssertionError ("not found {} {}" .format (x , y ))
834+
835+ def test_calls_showall_verbose (self , testdir ):
836+ testdir .makepyfile (self .source )
837+ result = testdir .runpytest ("--durations=0" , "-vv" )
838+ assert result .ret == 0
823839 for x in "123" :
824840 for y in ("call" ,): # 'setup', 'call', 'teardown':
825841 for line in result .stdout .lines :
@@ -830,9 +846,9 @@ def test_calls_showall(self, testdir):
830846
831847 def test_with_deselected (self , testdir ):
832848 testdir .makepyfile (self .source )
833- result = testdir .runpytest ("--durations=2" , "-k test_1 " )
849+ result = testdir .runpytest ("--durations=2" , "-k test_2 " )
834850 assert result .ret == 0
835- result .stdout .fnmatch_lines (["*durations*" , "*call*test_1 *" ])
851+ result .stdout .fnmatch_lines (["*durations*" , "*call*test_2 *" ])
836852
837853 def test_with_failing_collection (self , testdir ):
838854 testdir .makepyfile (self .source )
@@ -852,13 +868,15 @@ def test_with_not(self, testdir):
852868
853869class TestDurationWithFixture (object ):
854870 source = """
871+ import pytest
855872 import time
856- frag = 0.001
857- def setup_function(func):
858- time.sleep(frag * 3)
859- def test_1():
860- time.sleep(frag*2)
861- def test_2():
873+ frag = 0.01
874+
875+ @pytest.fixture
876+ def setup_fixt():
877+ time.sleep(frag)
878+
879+ def test_1(setup_fixt):
862880 time.sleep(frag)
863881 """
864882
0 commit comments