Skip to content

Commit

Permalink
pytest: use records to store RIOT version and experiment ID of test
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Aug 5, 2020
1 parent 54ff458 commit 8c84918
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def get_namefmt(request):


@pytest.fixture
def nodes(local, request, boards):
def nodes(local, request, boards, record_property):
"""
Provides the nodes for a test as a list of RIOTCtrl objects
"""
Expand Down Expand Up @@ -189,6 +189,7 @@ def nodes(local, request, boards):
site=os.environ.get("IOTLAB_SITE", DEFAULT_SITE))
RUNNING_EXPERIMENTS.append(exp)
exp.start(duration=IOTLAB_EXPERIMENT_DURATION)
record_property("exp_id", exp.exp_id)
yield ctrls
exp.stop()
RUNNING_EXPERIMENTS.remove(exp)
Expand Down Expand Up @@ -217,7 +218,7 @@ def update_env(node, modules=None, cflags=None, port=None, termflags=None):


@pytest.fixture
def riot_ctrl(log_nodes, nodes, riotbase):
def riot_ctrl(log_nodes, nodes, riotbase, record_property):
"""
Factory to create RIOTCtrl objects from list nodes provided by nodes
fixture
Expand Down Expand Up @@ -247,6 +248,12 @@ def ctrl(nodes_idx, application_dir, shell_interaction_cls,
factory_ctrls.append(node)
return shell_interaction_cls(node)

record_property(
"riot_commit",
subprocess.check_output(
["git", "-C", riotbase, "log", "--oneline", "--decorate", "-1"]
).decode().strip()
)
yield ctrl

for node in factory_ctrls:
Expand Down

0 comments on commit 8c84918

Please sign in to comment.