Remove duplicate random_string from umamba tests

This commit is contained in:
AntoinePrv 2022-09-06 13:04:10 +02:00
parent 6893ceaa33
commit 8a31b22905
2 changed files with 6 additions and 11 deletions

View File

@ -1,8 +1,5 @@
import os
import pathlib
import random
import shutil
import string
from typing import Generator
import pytest
@ -78,12 +75,9 @@ def tmp_clean_env(
os.environ.update(saved_environ)
def random_str(n: int = 10) -> str:
"""Return random characters and digits."""
return "".join(random.choices(string.ascii_uppercase + string.digits, k=n))
@pytest.fixture(params=[random_str, "some ™∞¢3 spaces §∞©ƒ√≈ç", "long_prefix_" * 20])
@pytest.fixture(
params=[helpers.random_string, "some ™∞¢3 spaces §∞©ƒ√≈ç", "long_prefix_" * 20]
)
def tmp_env_name(request) -> str:
"""Return the explicit or implicit parametrization."""
if callable(request.param):

View File

@ -67,8 +67,9 @@ def get_umamba(cwd=os.getcwd()):
return umamba
def random_string(N=10):
return "".join(random.choices(string.ascii_uppercase + string.digits, k=N))
def random_string(n: int = 10) -> str:
"""Return random characters and digits."""
return "".join(random.choices(string.ascii_uppercase + string.digits, k=n))
def shell(*args, cwd=os.getcwd()):