Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytest: use records to store RIOT version and experiment ID of test #188

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,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 @@ -215,6 +215,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 @@ -243,7 +244,9 @@ def update_env(node, modules=None, cflags=None, port=None, termflags=None):


@pytest.fixture
def riot_ctrl(log_nodes, log_file_fmt, nodes, riotbase, request):
# pylint: disable=R0913
def riot_ctrl(log_nodes, log_file_fmt, nodes, riotbase, request,
record_property):
"""
Factory to create RIOTCtrl objects from list nodes provided by nodes
fixture
Expand Down Expand Up @@ -288,6 +291,18 @@ 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()
)
record_property(
"release_specs_commit",
subprocess.check_output(
["git", "-C", os.getcwd(), "log", "--oneline", "--decorate", "-1"]
).decode().strip()
)
yield ctrl

for node in factory_ctrls:
Expand Down