pytest-dev/pytest-splinter

Problem inside of docker

cddumanov opened this issue · 1 comments

Hello! I want to setup pytest-splinter to run inside of docker container. But when I run I have this error. I run just pytest without additional options. Please help to fix.

test_1 | ============================= test session starts ============================== test_1 | platform linux -- Python 3.7.2, pytest-5.3.2, py-1.8.1, pluggy-0.13.1 test_1 | Django settings: settings.settings_live (from environment variable) test_1 | rootdir: /backend_django/backend_main_mydoctors, inifile: pytest.ini test_1 | plugins: splinter-2.0.1, django-3.7.0, bdd-3.2.1 test_1 | collected 1 item test_1 | test_1 | backend_main_mydoctors/apps/root/tests/test_root.py F [100%] test_1 | test_1 | =================================== FAILURES =================================== test_1 | ________________________________ test_root_page ________________________________ test_1 | test_1 | splinter_webdriver = 'chrome', retry_count = 3 test_1 | test_1 | def get_browser(splinter_webdriver, retry_count=3): test_1 | kwargs = get_args(driver=splinter_webdriver, test_1 | download_dir=splinter_file_download_dir, test_1 | download_ftypes=splinter_download_file_types, test_1 | firefox_pref=splinter_firefox_profile_preferences, test_1 | firefox_prof_dir=splinter_firefox_profile_directory, test_1 | remote_url=splinter_remote_url, test_1 | executable=splinter_webdriver_executable, test_1 | headless=splinter_headless, test_1 | driver_kwargs=splinter_driver_kwargs) test_1 | try: test_1 | return splinter_browser_class( test_1 | splinter_webdriver, visit_condition=splinter_browser_load_condition, test_1 | visit_condition_timeout=splinter_browser_load_timeout, test_1 | > wait_time=splinter_wait_time, **kwargs test_1 | ) test_1 | test_1 | /usr/local/lib/python3.7/site-packages/pytest_splinter/plugin.py:517: test_1 | _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test_1 | test_1 | args = ('chrome',), kwargs = {'headless': True, 'wait_time': 5} test_1 | visit_condition = <function splinter_browser_load_condition.<locals>.<lambda> at 0x7eff35f2bbf8> test_1 | visit_condition_timeout = 10 test_1 | test_1 | def Browser(*args, **kwargs): test_1 | """Emulate splinter's Browser.""" test_1 | visit_condition = kwargs.pop('visit_condition') test_1 | visit_condition_timeout = kwargs.pop('visit_condition_timeout') test_1 | > browser = splinter.Browser(*args, **kwargs) test_1 | test_1 | /usr/local/lib/python3.7/site-packages/pytest_splinter/plugin.py:72: test_1 | _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test_1 | test_1 | driver_name = 'chrome', retry_count = 3, args = () test_1 | kwargs = {'headless': True, 'wait_time': 5} test_1 | driver = <class 'splinter.driver.webdriver.chrome.WebDriver'> test_1 | test_1 | def Browser(driver_name="firefox", retry_count=3, *args, **kwargs): test_1 | """ test_1 | Returns a driver instance for the given name. test_1 | test_1 | When working with ``firefox``, it's possible to provide a profile name test_1 | and a list of extensions. test_1 | test_1 | If you don't provide any driver_name, then ``firefox`` will be used. test_1 | test_1 | If there is no driver registered with the provided ``driver_name``, this test_1 | function will raise a :class:splinter.exceptions.DriverNotFoundError test_1 | exception. test_1 | """ test_1 | test_1 | try: test_1 | driver = _DRIVERS[driver_name] test_1 | except KeyError: test_1 | raise DriverNotFoundError("No driver for %s" % driver_name) test_1 | test_1 | > return get_driver(driver, *args, **kwargs) test_1 | test_1 | /usr/local/lib/python3.7/site-packages/splinter/browser.py:90: test_1 | _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test_1 | test_1 | driver = <class 'splinter.driver.webdriver.chrome.WebDriver'>, retry_count = 3 test_1 | args = (), kwargs = {'headless': True, 'wait_time': 5}, _ = 2 test_1 | test_1 | def get_driver(driver, retry_count=3, *args, **kwargs): test_1 | """Try to instantiate the driver. test_1 | test_1 | Common selenium errors are caught and a retry attempt occurs. test_1 | This can mitigate issues running on Remote WebDriver. test_1 | test_1 | """ test_1 | for _ in range(retry_count): test_1 | try: test_1 | return driver(*args, **kwargs) test_1 | except (IOError, HTTPException, WebDriverException, MaxRetryError) as e: test_1 | pass test_1 | test_1 | > raise e test_1 | E UnboundLocalError: local variable 'e' referenced before assignment test_1 | test_1 | /usr/local/lib/python3.7/site-packages/splinter/browser.py:68: UnboundLocalError test_1 | test_1 | During handling of the above exception, another exception occurred: test_1 | test_1 | splinter_webdriver = 'chrome', retry_count = 2 test_1 | test_1 | def get_browser(splinter_webdriver, retry_count=3): test_1 | kwargs = get_args(driver=splinter_webdriver, test_1 | download_dir=splinter_file_download_dir, test_1 | download_ftypes=splinter_download_file_types, test_1 | firefox_pref=splinter_firefox_profile_preferences, test_1 | firefox_prof_dir=splinter_firefox_profile_directory, test_1 | remote_url=splinter_remote_url, test_1 | executable=splinter_webdriver_executable, test_1 | headless=splinter_headless, test_1 | driver_kwargs=splinter_driver_kwargs) test_1 | try: test_1 | return splinter_browser_class( test_1 | splinter_webdriver, visit_condition=splinter_browser_load_condition, test_1 | visit_condition_timeout=splinter_browser_load_timeout, test_1 | > wait_time=splinter_wait_time, **kwargs test_1 | ) test_1 | test_1 | /usr/local/lib/python3.7/site-packages/pytest_splinter/plugin.py:517: test_1 | _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test_1 | test_1 | args = ('chrome',), kwargs = {'headless': True, 'wait_time': 5} test_1 | visit_condition = <function splinter_browser_load_condition.<locals>.<lambda> at 0x7eff35f2bbf8> test_1 | visit_condition_timeout = 10 test_1 | test_1 | def Browser(*args, **kwargs): test_1 | """Emulate splinter's Browser.""" test_1 | visit_condition = kwargs.pop('visit_condition') test_1 | visit_condition_timeout = kwargs.pop('visit_condition_timeout') test_1 | > browser = splinter.Browser(*args, **kwargs) test_1 | test_1 | /usr/local/lib/python3.7/site-packages/pytest_splinter/plugin.py:72: test_1 | _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test_1 | test_1 | driver_name = 'chrome', retry_count = 3, args = () test_1 | kwargs = {'headless': True, 'wait_time': 5} test_1 | driver = <class 'splinter.driver.webdriver.chrome.WebDriver'> test_1 | test_1 | def Browser(driver_name="firefox", retry_count=3, *args, **kwargs): test_1 | """ test_1 | Returns a driver instance for the given name. test_1 | test_1 | When working with ``firefox``, it's possible to provide a profile name test_1 | and a list of extensions. test_1 | test_1 | If you don't provide any driver_name, then ``firefox`` will be used. test_1 | test_1 | If there is no driver registered with the provided ``driver_name``, this test_1 | function will raise a :class:splinter.exceptions.DriverNotFoundErrortest_1 | exception. test_1 | """ test_1 | test_1 | try: test_1 | driver = _DRIVERS[driver_name] test_1 | except KeyError: test_1 | raise DriverNotFoundError("No driver for %s" % driver_name) test_1 | test_1 | > return get_driver(driver, *args, **kwargs) test_1 | test_1 | /usr/local/lib/python3.7/site-packages/splinter/browser.py:90: test_1 | _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test_1 | test_1 | driver = <class 'splinter.driver.webdriver.chrome.WebDriver'>, retry_count = 3 test_1 | args = (), kwargs = {'headless': True, 'wait_time': 5}, _ = 2 test_1 | test_1 | def get_driver(driver, retry_count=3, *args, **kwargs): test_1 | """Try to instantiate the driver. test_1 | test_1 | Common selenium errors are caught and a retry attempt occurs. test_1 | This can mitigate issues running on Remote WebDriver. test_1 | test_1 | """ test_1 | for _ in range(retry_count): test_1 | try: test_1 | return driver(*args, **kwargs) test_1 | except (IOError, HTTPException, WebDriverException, MaxRetryError) as e: test_1 | pass test_1 | test_1 | > raise e test_1 | E UnboundLocalError: local variable 'e' referenced before assignment test_1 | test_1 | /usr/local/lib/python3.7/site-packages/splinter/browser.py:68: UnboundLocalError test_1 | test_1 | During handling of the above exception, another exception occurred: test_1 | test_1 | request = <FixtureRequest for <Function test_root_page>> test_1 | test_1 | @pytest.mark.usefixtures(*function_args) test_1 | def scenario_wrapper(request): test_1 | > _execute_scenario(feature, scenario, request, encoding) test_1 | test_1 | /usr/local/lib/python3.7/site-packages/pytest_bdd/scenario.py:227: test_1 | _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test_1 | /usr/local/lib/python3.7/site-packages/pytest_bdd/scenario.py:189: in _execute_scenario test_1 | _execute_step_function(request, scenario, step, step_func) test_1 | /usr/local/lib/python3.7/site-packages/pytest_bdd/scenario.py:125: in _execute_step_function test_1 | kwargs = dict((arg, request.getfixturevalue(arg)) for arg in get_args(step_func)) test_1 | /usr/local/lib/python3.7/site-packages/pytest_bdd/scenario.py:125: in <genexpr> test_1 | kwargs = dict((arg, request.getfixturevalue(arg)) for arg in get_args(step_func)) test_1 | /usr/local/lib/python3.7/site-packages/_pytest/fixtures.py:482: in getfixturevalue test_1 | return self._get_active_fixturedef(argname).cached_result[0] test_1 | /usr/local/lib/python3.7/site-packages/_pytest/fixtures.py:498: in _get_active_fixturedef test_1 | self._compute_fixture_value(fixturedef) test_1 | /usr/local/lib/python3.7/site-packages/_pytest/fixtures.py:579: in _compute_fixture_value test_1 | fixturedef.execute(request=subrequest) test_1 | /usr/local/lib/python3.7/site-packages/_pytest/fixtures.py:908: in execute test_1 | return hook.pytest_fixture_setup(fixturedef=self, request=request) test_1 | /usr/local/lib/python3.7/site-packages/pluggy/hooks.py:286: in __call__ test_1 | return self._hookexec(self, self.get_hookimpls(), kwargs) test_1 | /usr/local/lib/python3.7/site-packages/pluggy/manager.py:93: in _hookexec test_1 | return self._inner_hookexec(hook, methods, kwargs) test_1 | /usr/local/lib/python3.7/site-packages/pluggy/manager.py:87: in <lambda> test_1 | firstresult=hook.spec.opts.get("firstresult") if hook.spec else False, test_1 | /usr/local/lib/python3.7/site-packages/_pytest/fixtures.py:957: in pytest_fixture_setup test_1 | result = call_fixture_func(fixturefunc, request, kwargs) test_1 | /usr/local/lib/python3.7/site-packages/_pytest/fixtures.py:787: in call_fixture_func test_1 | res = fixturefunc(**kwargs) test_1 | /usr/local/lib/python3.7/site-packages/pytest_splinter/plugin.py:607: in browser test_1 | return browser_instance_getter(request, browser) test_1 | /usr/local/lib/python3.7/site-packages/pytest_splinter/plugin.py:536: in prepare_browser test_1 | browser = browser_pool[browser_key] = get_browser(splinter_webdriver) test_1 | /usr/local/lib/python3.7/site-packages/pytest_splinter/plugin.py:521: in get_browser test_1 | return get_browser(splinter_webdriver, retry_count - 1) test_1 | /usr/local/lib/python3.7/site-packages/pytest_splinter/plugin.py:521: in get_browser test_1 | return get_browser(splinter_webdriver, retry_count - 1) test_1 | /usr/local/lib/python3.7/site-packages/pytest_splinter/plugin.py:517: in get_browser test_1 | wait_time=splinter_wait_time, **kwargs test_1 | /usr/local/lib/python3.7/site-packages/pytest_splinter/plugin.py:72: in Browser test_1 | browser = splinter.Browser(*args, **kwargs) test_1 | /usr/local/lib/python3.7/site-packages/splinter/browser.py:90: in Browser test_1 | return get_driver(driver, *args, **kwargs) test_1 | _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ test_1 | test_1 | driver = <class 'splinter.driver.webdriver.chrome.WebDriver'>, retry_count = 3 test_1 | args = (), kwargs = {'headless': True, 'wait_time': 5}, _ = 2 test_1 | test_1 | def get_driver(driver, retry_count=3, *args, **kwargs): test_1 | """Try to instantiate the driver. test_1 | test_1 | Common selenium errors are caught and a retry attempt occurs. test_1 | This can mitigate issues running on Remote WebDriver. test_1 | test_1 | """ test_1 | for _ in range(retry_count): test_1 | try: test_1 | return driver(*args, **kwargs) test_1 | except (IOError, HTTPException, WebDriverException, MaxRetryError) as e: test_1 | pass test_1 | test_1 | > raise e test_1 | E UnboundLocalError: local variable 'e' referenced before assignment test_1 | test_1 | /usr/local/lib/python3.7/site-packages/splinter/browser.py:68: UnboundLocalError test_1 | ----------------------------- Captured stdout call ----------------------------- test_1 | 2 test_1 | ============================== 1 failed in 9.62s ===============================

Downgrade to splinter 0.12.0