MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_timing_function

Method test_timing_function

testing/test_junitxml.py:228–246  ·  view source on GitHub ↗
(
        self, pytester: Pytester, run_and_parse: RunAndParse, mock_timing
    )

Source from the content-addressed store, hash-verified

226 assert start_time <= timestamp < datetime.now()
227
228 def test_timing_function(
229 self, pytester: Pytester, run_and_parse: RunAndParse, mock_timing
230 ) -> None:
231 pytester.makepyfile(
232 """
233 from _pytest import timing
234 def setup_module():
235 timing.sleep(1)
236 def teardown_module():
237 timing.sleep(2)
238 def test_sleep():
239 timing.sleep(4)
240 """
241 )
242 result, dom = run_and_parse()
243 node = dom.find_first_by_tag("testsuite")
244 tnode = node.find_first_by_tag("testcase")
245 val = tnode["time"]
246 assert float(val) == 7.0
247
248 @pytest.mark.parametrize("duration_report", ["call", "total"])
249 def test_junit_duration_report(

Callers

nothing calls this directly

Calls 3

run_and_parseFunction · 0.85
find_first_by_tagMethod · 0.80
makepyfileMethod · 0.45

Tested by

no test coverage detected