def jm(request, jobs_ds): """ Give a test access to a JobsModel instance. """ model = JobsModel(jobs_ds.project) # patch in additional test-only procs on the datasources add_test_procs_file( model.get_dhub(), model.get_datasource().key, "jobs_test.json", ) def fin(): model.disconnect() request.addfinalizer(fin) return model
def refdata(): """returns a patched RefDataManager for testing purpose""" import os from treeherder.model.derived import RefDataManager from tests.conftest import add_test_procs_file refdata = RefDataManager() proc_path = os.path.join( os.path.abspath(os.path.dirname(__file__)), 'refdata_test.json' ) add_test_procs_file(refdata.dhub, 'reference', proc_path) return refdata
def refdata(request): """returns a patched RefDataManager for testing purpose""" from treeherder.model.derived import RefDataManager from tests.conftest import add_test_procs_file refdata = RefDataManager() proc_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'refdata_test.json') add_test_procs_file(refdata.dhub, 'reference', proc_path) def fin(): refdata.disconnect() request.addfinalizer(fin) return refdata
def jm(request): """ Give a test access to a JobsModel instance. """ from django.conf import settings from treeherder.model.derived.jobs import JobsModel model = JobsModel.create(settings.DATABASES["default"]["TEST_NAME"]) # patch in additional test-only procs on the datasources add_test_procs_file( model.get_dhub(), model.get_datasource().key, "jobs_test.json", ) def fin(): model.disconnect() request.addfinalizer(fin) return model