Skip to content

Commit e869692

Browse files
committed
fixup! Add comprehensive coverage infrastructure with clang source-based coverage
1 parent 6144307 commit e869692

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

tests/conftest.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import pytest
2+
3+
from pyln.testing.utils import EXPERIMENTAL_DUAL_FUND
4+
5+
6+
# This function is based upon the example of how to
7+
# "[make] test result information available in fixtures" at:
8+
# https://pytest.org/latest/example/simple.html#making-test-result-information-available-in-fixtures
9+
# and:
10+
# https://github.com/pytest-dev/pytest/issues/288
11+
@pytest.hookimpl(tryfirst=True, hookwrapper=True)
12+
def pytest_runtest_makereport(item, call):
13+
# execute all other hooks to obtain the report object
14+
outcome = yield
15+
rep = outcome.get_result()
16+
17+
# set a report attribute for each phase of a call, which can
18+
# be "setup", "call", "teardown"
19+
20+
setattr(item, "rep_" + rep.when, rep)
21+
22+
23+
def pytest_configure(config):
24+
config.addinivalue_line("markers",
25+
"slow_test: slow tests aren't run under Valgrind")
26+
config.addinivalue_line("markers",
27+
"openchannel: Limit this test to only run 'v1' or 'v2' openchannel protocol")
28+
29+
30+
def pytest_runtest_setup(item):
31+
open_versions = [mark.args[0] for mark in item.iter_markers(name='openchannel')]
32+
if open_versions:
33+
if 'v1' not in open_versions and not EXPERIMENTAL_DUAL_FUND:
34+
pytest.skip('v2-only test, EXPERIMENTAL_DUAL_FUND=0')
35+
if 'v2' not in open_versions and EXPERIMENTAL_DUAL_FUND:
36+
pytest.skip('v1-only test, EXPERIMENTAL_DUAL_FUND=1')
37+
else: # If there's no openchannel marker, skip if EXP_DF
38+
if EXPERIMENTAL_DUAL_FUND:
39+
pytest.skip('v1-only test, EXPERIMENTAL_DUAL_FUND=1')

0 commit comments

Comments
 (0)