Something went wrong on our end
Forked from
FSL / fslpy
2545 commits behind the upstream repository.
-
Paul McCarthy authored
covered 'at least two elements' anyway. Maybe this will bite me, I don't know.
Paul McCarthy authoredcovered 'at least two elements' anyway. Maybe this will bite me, I don't know.
conftest.py 1.20 KiB
#!/usr/bin/env python
#
# conftest.py -
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
import pytest
import os.path as op
import random
import numpy as np
def pytest_addoption(parser):
parser.addoption('--niters',
type=int,
action='store',
default=150,
help='Number of test iterations for imagewrapper')
parser.addoption('--testdir',
action='store',
help='FSLeyes test data directory')
parser.addoption('--seed',
type=int,
help='Seed for random number generator')
@pytest.fixture
def testdir(request):
"""FSLeyes test data directory."""
return op.expanduser(request.config.getoption('--testdir'))
@pytest.fixture
def niters(request):
"""Number of test iterations."""
return request.config.getoption('--niters')
@pytest.fixture
def seed(request):
seed = request.config.getoption('--seed')
if seed is None:
seed = np.random.randint(2 ** 32)
np.random.seed(seed)
random .seed(seed)
print('Seed for random number generator: {}'.format(seed))
return seed