MCPcopy Create free account
hub / github.com/ElementsProject/lightning / pytest_pyfunc_call

Function pytest_pyfunc_call

conftest.py:39–73  ·  view source on GitHub ↗
(pyfuncitem)

Source from the content-addressed store, hash-verified

37
38@pytest.hookimpl(hookwrapper=True)
39def pytest_pyfunc_call(pyfuncitem):
40 global result
41 result = result.copy()
42 result["testname"] = pyfuncitem.name
43 result["start_time"] = int(time())
44 outcome = yield
45 result["end_time"] = int(time())
46 # outcome.excinfo may be None or a (cls, val, tb) tuple
47
48 if outcome.excinfo is None:
49 result["outcome"] = "success"
50 elif outcome.excinfo[0] == unittest.case.SkipTest:
51 result["outcome"] = "skip"
52 else:
53 result["outcome"] = "fail"
54
55 print(result)
56
57 if not server:
58 return
59
60 try:
61 req = request.Request(f"{server}/hook/test", method="POST")
62 req.add_header("Content-Type", "application/json")
63
64 request.urlopen(
65 req,
66 data=json.dumps(result).encode("ASCII"),
67 )
68 except ConnectionError as e:
69 print(f"Could not report testrun: {e}")
70 except Exception as e:
71 import warnings
72
73 warnings.warn(f"Error reporting testrun: {e}")

Callers

nothing calls this directly

Calls 1

encodeMethod · 0.45

Tested by

no test coverage detected