Skip to content

Commit

Permalink
Tests: Update test_rucio_bin to use fixtures, rucio#6529
Browse files Browse the repository at this point in the history
  • Loading branch information
voetberg committed Mar 13, 2024
1 parent ec84fe0 commit e175bc2
Show file tree
Hide file tree
Showing 2 changed files with 2,204 additions and 2,333 deletions.
26 changes: 25 additions & 1 deletion tests/conftest.py
Expand Up @@ -31,7 +31,7 @@

def pytest_configure(config):
config.addinivalue_line('markers', 'dirty: marks test as dirty, i.e. tests are leaving structures behind')
config.addinivalue_line('markers', 'noparallel(reason, groups): marks test being unable to run in parallel to other tests' )
config.addinivalue_line('markers', 'noparallel(reason, groups): marks test being unable to run in parallel to other tests')

if config.pluginmanager.hasplugin("xdist"):
from .ruciopytest import xdist_noparallel_scheduler
Expand Down Expand Up @@ -579,3 +579,27 @@ def metrics_mock():
mock.patch('rucio.core.monitor.TIMINGS', new={}), \
mock.patch('prometheus_client.values.ValueClass', new=values.MutexValue):
yield registry


@pytest.fixture
def upload_success_str():
return lambda x: f'Successfully uploaded file {x}'


@pytest.fixture
def account_name_generator():
from rucio.common.utils import generate_uuid
return lambda: 'jdoe-' + str(generate_uuid()).lower()[:16]


@pytest.fixture
def scope_name_generator():
from rucio.common.utils import generate_uuid
return lambda: 'mock_' + str(generate_uuid()).lower()[:16]


@pytest.fixture
def rse_name_generator():
def generator(size=10):
return 'MOCK-' + ''.join(choice(ascii_uppercase) for _ in range(size))
return generator

0 comments on commit e175bc2

Please sign in to comment.