How to use the pytest.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 CenterForOpenScience / / api_tests / providers / preprints / views / View on Github external
@pytest.fixture(params=['/{}preprint_providers/?version=2.2&', '/{}providers/preprints/?version=2.2&'])
def url(request):
    url = (request.param)
    return url.format(API_BASE)
github brabiega / quakestats / tests / unit / View on Github external
    def badger(self):
        scores = mock.Mock() = 'scores'
        special_scores = mock.Mock() = 'special_scores'

        return Badger(scores, special_scores)
github Ulauncher / Ulauncher / tests / search / apps / View on Github external
    def event_handler(self, db):
        AppNotifyEventHandler.RETRY_INTERVAL = 0.05
        AppNotifyEventHandler.RETRY_TIME_SPAN = (0, 30)
        return AppNotifyEventHandler(db)
github OpenGeoscience / geonotebook / tests / View on Github external
def kw_only(nbprotocoldict):
    return nbprotocoldict['kw_only']
github joerick / cibuildwheel / unit_test / View on Github external
def fake_project_dir(monkeypatch):
    Monkey-patch enough for the main() function to run

    real_os_path_exists = os.path.exists
    def mock_os_path_exists(path):
        if path == os.path.join(MOCK_PROJECT_DIR, ''):
            return True
            return real_os_path_exists(path)

    monkeypatch.setattr(os.path, 'exists', mock_os_path_exists)
    monkeypatch.setattr(sys, 'argv', ['cibuildwheel', MOCK_PROJECT_DIR])
github bbengfort / confire / tests / View on Github external
@pytest.fixture(scope='function', autouse=True)
def destroy_paths():
    if os.path.exists(MDROOT):

    # Delete contents of the test file
    with open(TESTFILE, 'w') as f:
github OmegaK2 / PyPoE / tests / PyPoE / poe / View on Github external
def patch():
    return patchserver.Patch()
github pytest-dev / pytest-mimesis / pytest_mimesis / View on Github external
def business(locale):

    :param locale:
    return Business(locale)
github OSGeo / gdal / autotest / ogr / View on Github external
def startup_and_cleanup():

    gdaltest.geojson_drv = ogr.GetDriverByName('GeoJSON')

github bradleyhurley / PyBall / test / View on Github external
def error_message(request):
    return {
        'messageNumber': request.param,
        'message': 'test message',