How to use the pytest.yield_fixture function in pytest

To help you get started, we’ve selected a few pytest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pytest-dev / pytest / testing / example_scripts / View on Github external
def fix2(request, fix1, arg2, checked_order):
    checked_order.append((, "fix2", arg2))
    yield "fix2-" + arg2 + fix1
github dbrattli / aioreactive / test / View on Github external
def event_loop():
    loop = VirtualTimeEventLoop()
    yield loop
github CenterForOpenScience / waterbutler / tests / View on Github external
def temp_files():
    context = TempFilesContext()
    yield context
github aws / aws-encryption-sdk-cli / test / unit / internal / View on Github external
def patch_logging_levels(mocker):
    mocker.patch.object(logging_utils, "_logging_levels")
    yield logging_utils._logging_levels
github d-chambers / Detex / tests / test_cases / View on Github external
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  
github nameko / nameko / test / standalone / View on Github external
    def retry(self, request):
        retry = False
        if "publish_retry" in request.keywords:
            retry = True

        with patch.object(MethodProxy.publisher_cls, 'retry', new=retry):
github nameko / nameko / test / View on Github external
    def get_producer(self):
        with patch('nameko.amqp.publish.get_producer') as get_producer:
            yield get_producer
github moinwiki / moin / src / moin / apps / frontend / _tests / View on Github external
    def custom_setup(self, app):
        saved_user = flaskg.user
        flaskg.user = user.User()
        flaskg.user = saved_user
github uber-archive / pyflame / tests / View on Github external
def exit_early():
    with python_proc('') as p:
        yield p
github Mirantis / stepler / stepler / cinder / fixtures / View on Github external
def create_volume_transfer(transfer_steps):
    """Callable function fixture to create volume transfer with options.

    Can be called several times during test.

        transfer_steps (VolumeTransferSteps): instantiated transfer steps

        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)