Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallel test with selenium fails #1926

Closed
m3nthal opened this issue Sep 9, 2016 · 10 comments
Closed

Parallel test with selenium fails #1926

m3nthal opened this issue Sep 9, 2016 · 10 comments
Labels
plugin: xdist related to the xdist external plugin type: bug problem that needs to be addressed

Comments

@m3nthal
Copy link

m3nthal commented Sep 9, 2016

The following code was run with -n 2 --browser Chrome:

import pytest

@pytest.fixture
def selenium(selenium):
    return selenium

def test_one(selenium):
    selenium.get("http://www.python.org")

def test_two(selenium):
    selenium.get("http://www.google.com")

Two browser windows are opened and the the pages were loaded. Then the execution was terminated:

============================= test session starts ==============================
platform darwin -- Python 3.5.1, pytest-2.9.0, py-1.4.31, pluggy-0.3.1
driver: Chrome
sensitiveurl: .*
rootdir: /Users/username/python/parallel_test, inifile: 
plugins: allure-adaptor-1.7.5, base-url-1.1.0, html-1.10.0, selenium-1.3.1, variables-1.4, xdist-1.15.0
gw0 I / gw1 I
gw0 [2] / gw1 [2]

scheduling tests via LoadScheduling
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/Users/username/.pyenv/versions/3.5.1/lib/python3.5/site-packages/_pytest/main.py", line 94, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/Users/username/.pyenv/versions/3.5.1/lib/python3.5/site-packages/_pytest/main.py", line 125, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/Users/username/.pyenv/versions/3.5.1/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 724, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/Users/username/.pyenv/versions/3.5.1/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 338, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/Users/username/.pyenv/versions/3.5.1/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 333, in <lambda>
INTERNALERROR>     _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR>   File "/Users/username/.pyenv/versions/3.5.1/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 596, in execute
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/username/.pyenv/versions/3.5.1/lib/python3.5/site-packages/xdist/dsession.py", line 536, in pytest_runtestloop
INTERNALERROR>     self.loop_once()
INTERNALERROR>   File "/Users/username/.pyenv/versions/3.5.1/lib/python3.5/site-packages/xdist/dsession.py", line 555, in loop_once
INTERNALERROR>     call(**kwargs)
INTERNALERROR>   File "/Users/username/.pyenv/versions/3.5.1/lib/python3.5/site-packages/xdist/dsession.py", line 593, in slave_slavefinished
INTERNALERROR>     assert not crashitem, (crashitem, node)
INTERNALERROR> AssertionError: ('test.py::test_one', <SlaveController gw0>)

========================= no tests ran in 2.83 seconds =========================

pip list:
apipkg (1.4)
beautifulsoup4 (4.5.1)
enum34 (1.1.6)
execnet (1.4.1)
lxml (3.6.4)
namedlist (1.7)
pip (8.1.2)
py (1.4.31)
pyrsistent (0.11.13)
pytest (2.9.0)
pytest-allure-adaptor (1.7.5)
pytest-base-url (1.1.0)
pytest-html (1.10.0)
pytest-selenium (1.3.1)
pytest-variables (1.4)
pytest-xdist (1.15.0)
PyYAML (3.11)
requests (2.10.0)
selenium (2.53.5)
setuptools (18.2)
six (1.10.0)

@nicoddemus
Copy link
Member

nicoddemus commented Sep 14, 2016

Thanks for the report.

I assume it works if you execute without -n2?

@nicoddemus
Copy link
Member

nicoddemus commented Sep 14, 2016

Btw, that means that the test somehow crashed when executed in parallel, does pytest-selenium support xdist?

cc @davehunt

@davehunt
Copy link
Contributor

We're using pytest-selenium with pytest-xdist without any issues, and have been in one form or another for over 4 years. One difference I note is that the reporter is using python 3.5, which we have yet to switch to. Also, we don't use the pytest-allure-adapter, and use a later version of pytest.

@dshuga
Copy link

dshuga commented Dec 28, 2016

I'm seeing something pretty similar in certain circumstances when using xdist and flaky. I'm also using Python 3.5, I haven't yet tried another version. The circumstance is described in a ticket I filed with flaky: box/flaky#117

It's interesting that in my example I'm not using selenium, and in your example you're not using flaky.

@jakeczyz
Copy link

jakeczyz commented Mar 31, 2017

I saw the same thing (cross-posted/related: box/flaky#117). My env:
platform linux -- Python 3.6.0, pytest-3.0.7, py-1.4.33, pluggy-0.4.0 metadata: {'Python': '3.6.0', 'Platform': 'Linux-4.4.41-k8s-x86_64-with', 'Packages': {'pytest': '3.0.7', 'py': '1.4.33', 'pluggy': '0.4.0'}, 'Plugins': {'xdist': '1.15.0', 'tap': '2.0', 'metadata': '1.3.0', 'html': '1.14.2', 'flaky': '3.3.0'}}

@nicoddemus
Copy link
Member

@davehunt should we move this discussion over pytest-dev/pytest-selenium?

@davehunt
Copy link
Contributor

@nicoddemus I've not seen anything that convinces me this is a pytest-selenium issue. The latest comment shows pytest-selenium is not installed, ditto for the comment before it.

@nicoddemus
Copy link
Member

Oh OK, thanks Dave!

@nicoddemus
Copy link
Member

@m3nthal can you post a reproducible example? Unfortunately that error is quite generic and means that an internal error has occurred.

If you do find a minimal example, could you post a new issue in https://github.com/pytest-dev/pytest-xdist/issues? Thanks!

@nicoddemus nicoddemus added plugin: xdist related to the xdist external plugin type: bug problem that needs to be addressed labels Sep 29, 2017
@RonnyPfannschmidt
Copy link
Member

closing due to lack of further input

@RonnyPfannschmidt RonnyPfannschmidt closed this as not planned Won't fix, can't repro, duplicate, stale Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: xdist related to the xdist external plugin type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

6 participants