Skip to content

Commit

Permalink
Merge pull request #426 from jsmolar/jsmolar-fix-branch
Browse files Browse the repository at this point in the history
Moved custom test user name from utils to the blame method
  • Loading branch information
Jakub Smolar authored Jun 4, 2024
2 parents d2e9a3b + 7d0c395 commit 57a331b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 5 additions & 1 deletion testsuite/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ def oidc_provider(keycloak) -> OIDCProvider:
@pytest.fixture(scope="session")
def blame(request):
"""Returns function that will add random identifier to the name"""
if "tester" in settings:
user = settings["tester"]
else:
user = _whoami()

def _blame(name: str, tail: int = 3) -> str:
"""Create 'scoped' name within given test
Expand All @@ -247,7 +251,7 @@ def _blame(name: str, tail: int = 3) -> str:
if "." in context:
context = context.split(".")[0]

return randomize(f"{name[:8]}-{_whoami()[:8]}-{context[:9]}", tail=tail)
return randomize(f"{name[:8]}-{user[:8]}-{context[:9]}", tail=tail)

return _blame

Expand Down
4 changes: 0 additions & 4 deletions testsuite/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from weakget import weakget

from testsuite.certificates import Certificate, CFSSLClient, CertInfo
from testsuite.config import settings

MESSAGE_1KB = resources.files("testsuite.resources.performance.files").joinpath("message_1kb.txt")

Expand Down Expand Up @@ -46,9 +45,6 @@ def randomize(name, tail=5):

def _whoami():
"""Returns username"""
if "tester" in settings:
return settings["tester"]

try:
return getpass.getuser()
# want to catch broad exception and fallback at any circumstance
Expand Down

0 comments on commit 57a331b

Please sign in to comment.