예제 #1
0
def model_instance_caller():
    """
    Function-level pytest fixture. Returns a factory object that tracks
    model instances as they're created and clears them out when the
    test completes. Instances are created using whatever callable obj
    is passed to the factory.
    """
    with ff.FactoryTracker(ff.TestInstanceCallerFactory()) as make:
        yield make
예제 #2
0
def model_instance():
    """
    Function-level pytest fixture. Returns a factory object that tracks
    model instances as they're created and clears them out when the
    test completes. Instances are created via the manager's `create`
    method.
    """
    with ff.FactoryTracker(ff.TestInstanceFactory()) as make:
        yield make
예제 #3
0
def solr_conn():
    """
    Function-level pytest fixture. Returns a callable factory object
    for creating a pysolr connection, for interacting with a Solr core.
    The connection is completely cleared (all records within the core
    deleted) when the test completes.
    """
    with ff.FactoryTracker(ff.TestSolrConnectionFactory()) as make:
        yield make
예제 #4
0
def installed_test_class():
    """
    Function-level pytest fixture for temporarily installing a test
    class onto a particular module. The class may be installed as a
    brand new attribute, or it may override an existing class. Any
    changes are reverted after the test runs.
    """
    with ff.FactoryTracker(ff.TestClassRegistry()) as make:
        yield make
예제 #5
0
def global_model_instance(django_db_blocker):
    """
    Module-level pytest fixture. Returns a factory object that tracks
    model instances as they're created and clears them out when the
    module completes. This is the same as `model_instance`, except
    instances persist throughout all tests in a module.
    """
    with django_db_blocker.unblock():
        with ff.FactoryTracker(ff.TestInstanceFactory()) as make:
            yield make
예제 #6
0
def solr_data_assembler():
    """
    Function-level pytest fixture. Returns a callable factory for
    creating SolrTestDataAssembler objects, which allow you to make and
    manage multiple sets of Solr test data records. It tracks all
    records added via the factory and then clears them out when the
    test completes.
    """
    with ff.FactoryTracker(ff.SolrTestDataAssemblerFactory()) as make:
        yield make
예제 #7
0
def global_solr_data_assembler():
    """
    Module-level pytest fixture. Returns a callable factory for
    creating SolrTestDataAssembler objects, which allow you to make and
    manage multiple sets of Solr test data records. It tracks all
    records added via the factory and then clears them out when the
    module completes. This is the same as `solr_data_assembler`, except
    that the records created persist throughout all tests in a module.
    """
    with ff.FactoryTracker(ff.SolrTestDataAssemblerFactory()) as make:
        yield make
예제 #8
0
def global_solr_conn():
    """
    Module-level pytest fixture. Returns a callable factory object for
    creating a pysolr connection, for interacting with a Solr core. The
    connection is completely cleared (all records within the core
    deleted) when the module completes. This is the same as
    `solr_conn`, except that the connection isn't cleared after each
    function.
    """
    with ff.FactoryTracker(ff.TestSolrConnectionFactory()) as make:
        yield make