Skip to content

Commit

Permalink
Merge branch 'master' into pr/01
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKevinWeiss committed Jun 21, 2024
2 parents c7d9199 + a7770fa commit 6b40082
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion 09-coap/test_spec09.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def coap_get(
cmd = "coap get "
if confirmable:
cmd += "-c "
cmd += f"[{addr}]:{port:d} {resource}"
cmd += f"coap://[{addr}]:{port:d}{resource}"
return self.cmd(cmd, timeout=timeout, async_=async_)


Expand Down
12 changes: 12 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
See https://docs.pytest.org/en/stable/fixture.html#conftest-py-sharing-fixture-functions
""" # noqa: E501

import random
import re
import os
import subprocess
Expand All @@ -29,6 +30,7 @@
RIOTBASE = os.environ.get('RIOTBASE')
RUNNING_CTRLS = []
RUNNING_EXPERIMENTS = []
DEFAULT_PAN_ID = str(random.randint(0, 0xFFFD))


def pytest_addoption(parser):
Expand Down Expand Up @@ -279,6 +281,10 @@ def nodes(local, request, boards, iotlab_site):
for board in boards:
if local or only_native or IoTLABExperiment.valid_board(board):
env = {'BOARD': f'{board}'}
if only_native:
# XXX this does not work for a mix of native and non-native boards,
# but we do not have these in the release tests at the moment.
env["RIOT_TERMINAL"] = "native"
else:
env = {
'BOARD': IoTLABExperiment.board_from_iotlab_node(board),
Expand Down Expand Up @@ -317,6 +323,12 @@ def update_env(node, modules=None, cflags=None, port=None, termflags=None, extra
node.env.get('DOCKER_ENVIRONMENT_CMDLINE', '')
+ f" -e 'USEMODULE={node.env['USEMODULE']}'"
)
node.env['DEFAULT_PAN_ID'] = DEFAULT_PAN_ID
if os.environ.get('BUILD_IN_DOCKER', 0) == '1':
node.env['DOCKER_ENVIRONMENT_CMDLINE'] = (
node.env.get('DOCKER_ENVIRONMENT_CMDLINE', '')
+ f" -e 'DEFAULT_PAN_ID={node.env['DEFAULT_PAN_ID']}'"
)
if cflags is not None:
node.env['CFLAGS'] = cflags
if port is not None:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ pytest-cov
pytest-rerunfailures
riotctrl
scapy
paho-mqtt
paho-mqtt<2
10 changes: 5 additions & 5 deletions testutils/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import urllib.parse

from bs4 import BeautifulSoup
from github import Github, GithubException, InputFileContent
from github import Auth, Github, GithubException, InputFileContent

from testutils.git import Git, GitError

Expand Down Expand Up @@ -80,7 +80,7 @@ def get_github():
access_token = get_access_token()
if not access_token:
return None
return Github(access_token, base_url=API_URL)
return Github(auth=Auth.Token(access_token), base_url=API_URL)


def get_repo(github):
Expand Down Expand Up @@ -210,9 +210,9 @@ def create_comment(github, issue):
def _generate_outcome_summary(pytest_report, task):
# pylint: disable=C0209
return "<strong>{a_open}{outcome}{a_close}</strong>".format(
a_open='<a href="{}">'.format(task["outcome_url"])
if "outcome_url" in task
else '',
a_open=(
'<a href="{}">'.format(task["outcome_url"]) if "outcome_url" in task else ''
),
outcome=pytest_report.outcome.upper(),
a_close='</a>' if "outcome_url" in task else '',
)
Expand Down
11 changes: 6 additions & 5 deletions testutils/tests/test_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ def __init__(self, issues):

# pylint: disable=W0613
def get_issues(self, *args, **kwargs):
for issue in self.issues:
yield issue
yield from self.issues

issues = [MockIssue(title) for title in issue_titles]
repo = MockRepo(issues)
Expand Down Expand Up @@ -983,9 +982,11 @@ def test_upload_results(
monkeypatch.setattr(
testutils.github,
"get_results_gist",
lambda *args, **kwargs: (testutils.github.Git('.'), "", "the_gist_id")
if gist_created
else (None, None, None),
lambda *args, **kwargs: (
(testutils.github.Git('.'), "", "the_gist_id")
if gist_created
else (None, None, None)
),
)
monkeypatch.setattr(
testutils.github, "upload_result_content", lambda *args, **kwargs: head
Expand Down

0 comments on commit 6b40082

Please sign in to comment.