def pytest_configure(config): config.proc = subprocess.Popen(["geckodriver"]) config.add_cleanup(config.proc.kill) capabilities = {"alwaysMatch": {"acceptInsecureCerts": True, "moz:firefoxOptions": {}}} if config.getoption("--binary"): capabilities["alwaysMatch"]["moz:firefoxOptions"]["binary"] = config.getoption("--binary") if config.getoption("--headless"): capabilities["alwaysMatch"]["moz:firefoxOptions"]["args"] = ["--headless"] config.driver = webdriver.Session("localhost", 4444, capabilities=capabilities) config.add_cleanup(config.driver.end) config.server = WPTServer(WPT_ROOT) config.server.start() # Although the name of the `_create_unverified_context` method suggests # that it is not intended for external consumption, the standard library's # documentation explicitly endorses its use: # # > To revert to the previous, unverified, behavior # > ssl._create_unverified_context() can be passed to the context # > parameter. # # https://docs.python.org/2/library/httplib.html#httplib.HTTPSConnection config.ssl_context = ssl._create_unverified_context() config.add_cleanup(config.server.stop)
def pytest_configure(config): config.driver = webdriver.Firefox( firefox_binary=config.getoption("--binary")) config.server = WPTServer(WPT_ROOT) config.server.start() config.add_cleanup(config.server.stop) config.add_cleanup(config.driver.quit)
def pytest_configure(config): config.driver = webdriver.Firefox( firefox_binary=config.getoption("--binary")) config.server = WPTServer(WPT_ROOT) config.server.start() # Although the name of the `_create_unverified_context` method suggests # that it is not intended for external consumption, the standard library's # documentation explicitly endorses its use: # # > To revert to the previous, unverified, behavior # > ssl._create_unverified_context() can be passed to the context # > parameter. # # https://docs.python.org/2/library/httplib.html#httplib.HTTPSConnection config.ssl_context = ssl._create_unverified_context() config.add_cleanup(config.server.stop) config.add_cleanup(config.driver.quit)
def pytest_configure(config): config.driver = webdriver.Firefox() config.server = WPTServer(WPT_ROOT) config.server.start() config.add_cleanup(lambda: config.server.stop()) config.add_cleanup(lambda: config.driver.quit())