Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@pytest.yield_fixture(scope="function")
def fix2(request, fix1, arg2, checked_order):
checked_order.append((request.node.name, "fix2", arg2))
yield "fix2-" + arg2 + fix1
@pytest.yield_fixture()
def event_loop():
loop = VirtualTimeEventLoop()
yield loop
loop.close()
@pytest.yield_fixture
def temp_files():
context = TempFilesContext()
yield context
context.tear_down()
@pytest.yield_fixture
def patch_logging_levels(mocker):
mocker.patch.object(logging_utils, "_logging_levels")
yield logging_utils._logging_levels
@pytest.yield_fixture(scope="session")
def make_data_dirs(load_keys):
temkey, stakey, phases = load_keys
detex.getdata.makeDataDirectories(templateKey=temkey, stationKey=stakey)
# dont delete when finished gitignore will keep it from being pushed
@pytest.yield_fixture(autouse=True)
def retry(self, request):
retry = False
if "publish_retry" in request.keywords:
retry = True
with patch.object(MethodProxy.publisher_cls, 'retry', new=retry):
yield
@pytest.yield_fixture
def get_producer(self):
with patch('nameko.amqp.publish.get_producer') as get_producer:
yield get_producer
@pytest.yield_fixture(autouse=True)
def custom_setup(self, app):
saved_user = flaskg.user
flaskg.user = user.User()
yield
flaskg.user = saved_user
@pytest.yield_fixture
def exit_early():
with python_proc('exit_early.py') as p:
yield p
@pytest.yield_fixture
def create_volume_transfer(transfer_steps):
"""Callable function fixture to create volume transfer with options.
Can be called several times during test.
Args:
transfer_steps (VolumeTransferSteps): instantiated transfer steps
Yields:
function: function to create singe volume transfer with options
"""
volume_transfers = []
def _create_volume_transfer(*args, **kwgs):
volume_transfer = transfer_steps.create_volume_transfer(*args, **kwgs)
volume_transfers.append(volume_transfer)