Skip to content

Commit

Permalink
Add groups on testname for ease of ci debug
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarmet committed Aug 7, 2024
1 parent f757ade commit 7e2fc7d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bert_e/tests/test_bert_e.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from unittest.mock import Mock
from unittest.mock import patch
from urllib.parse import quote_plus
from os import getenv

import requests
import requests_mock
Expand Down Expand Up @@ -90,6 +91,9 @@
""" # noqa


log = logging.getLogger(__name__)


def initialize_git_repo(repo, username, usermail):
"""resets the git repo"""
assert '/ring/' not in repo._url # This is a security, do not remove
Expand Down Expand Up @@ -825,6 +829,10 @@ def bypass_all_but(self, exceptions):
def setUp(self):
warnings.resetwarnings()
warnings.simplefilter('ignore')
self.ci: bool = bool(getenv('CI', False))
if self.ci:
# print a group with the test name that is about to run
log.info(f"::group::{self._testMethodName}")
self.admin_id = None
self.contributor_id = None
# repo creator and reviewer
Expand Down Expand Up @@ -889,6 +897,9 @@ def tearDown(self):
self.admin_bb.delete()

self.gitrepo.delete()
if self.ci:
# end the group with the test name that just ran
log.info("::endgroup::")

def create_pr(
self,
Expand Down Expand Up @@ -7743,7 +7754,8 @@ def main():
jira_api.JiraIssue = jira_api_mock.JiraIssue

if RepositoryTests.args.verbose:
logging.basicConfig(level=logging.DEBUG)
# only the message in the format string will be displayed
logging.basicConfig(level=logging.DEBUG, format="%(message)s")
else:
# it is expected that Bert-E issues some warning
# during the tests, only report critical stuff
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ commands = coverage run -am bert_e.tests.test_server
[testenv:tests-noqueue]
deps =
pip==22.3.1
passenv = CI
commands =
coverage run -am bert_e.tests.test_bert_e \
-v \
Expand All @@ -48,6 +49,7 @@ commands =
[testenv:tests]
deps =
pip==22.3.1
passenv = CI
commands =
coverage run -am bert_e.tests.test_bert_e \
-v \
Expand Down

0 comments on commit 7e2fc7d

Please sign in to comment.