def pytest_configure(config): # Pytest has removed the global pytest.config # As a solution we are going to store it in PytestConf.config PytestConf.config = config if is_help_option_present(config): return if is_master(config): if not config.getoption('--hge-urls'): print("hge-urls should be specified") if not config.getoption('--pg-urls'): print("pg-urls should be specified") config.hge_url_list = config.getoption('--hge-urls') config.pg_url_list = config.getoption('--pg-urls') config.hge_ctx_gql_server = HGECtxGQLServer(config.hge_url_list) if config.getoption('-n', default=None): xdist_threads = config.getoption('-n') assert xdist_threads <= len( config.hge_url_list ), "Not enough hge_urls specified, Required " + str( xdist_threads) + ", got " + str(len(config.hge_url_list)) assert xdist_threads <= len( config.pg_url_list ), "Not enough pg_urls specified, Required " + str( xdist_threads) + ", got " + str(len(config.pg_url_list)) random.seed(datetime.now())
def pytest_configure(config): if is_master(config): config.hge_ctx_gql_server = HGECtxGQLServer() if not config.getoption('--hge-urls'): print("hge-urls should be specified") if not config.getoption('--pg-urls'): print("pg-urls should be specified") config.hge_url_list = config.getoption('--hge-urls') config.pg_url_list = config.getoption('--pg-urls') if config.getoption('-n', default=None): xdist_threads = config.getoption('-n') assert xdist_threads <= len(config.hge_url_list), "Not enough hge_urls specified, Required " + str(xdist_threads) + ", got " + str(len(config.hge_url_list)) assert xdist_threads <= len(config.pg_url_list), "Not enough pg_urls specified, Required " + str(xdist_threads) + ", got " + str(len(config.pg_url_list)) random.seed(datetime.now())
def gql_server(request, hge_ctx): server = HGECtxGQLServer(request.config.getoption('--pg-urls'), 5991) yield server server.teardown()