MCPcopy
hub / github.com/pytest-dev/pytest / test_timing_function

Method test_timing_function

testing/test_junitxml.py:293–315  ·  view source on GitHub ↗
(
        self,
        pytester: Pytester,
        run_and_parse: RunAndParse,
        mock_timing: _pytest.timing.MockTiming,
    )

Source from the content-addressed store, hash-verified

291 assert start_time <= timestamp < datetime.now(timezone.utc)
292
293 def test_timing_function(
294 self,
295 pytester: Pytester,
296 run_and_parse: RunAndParse,
297 mock_timing: _pytest.timing.MockTiming,
298 ) -> None:
299 pytester.makepyfile(
300 """
301 from _pytest import timing
302 def setup_module():
303 timing.sleep(1)
304 def teardown_module():
305 timing.sleep(2)
306 def test_sleep():
307 timing.sleep(4)
308 """
309 )
310 _result, dom = run_and_parse()
311 node = dom.get_first_by_tag("testsuite")
312 tnode = node.get_first_by_tag("testcase")
313 val = tnode["time"]
314 assert val is not None
315 assert float(val) == 7.0
316
317 @pytest.mark.parametrize("duration_report", ["call", "total"])
318 def test_junit_duration_report(

Callers

nothing calls this directly

Calls 3

run_and_parseFunction · 0.85
get_first_by_tagMethod · 0.80
makepyfileMethod · 0.45

Tested by

no test coverage detected