Skip to content

Instantly share code, notes, and snippets.

@poliarush
Created August 2, 2013 08:27
Show Gist options
  • Save poliarush/6138334 to your computer and use it in GitHub Desktop.
Save poliarush/6138334 to your computer and use it in GitHub Desktop.
py.test --capture=no --browser=ff -n 3 --junitxml=junit.xml .
py.test --capture=no --browser=ff -n 3 --junitxml=junit.xml .
c:\temp\xdist
>py.test --capture=no --browser=ff -n 3 --junitxml=junit.xml .
============================= test session starts =============================
platform win32 -- Python 2.7.3 -- pytest-2.3.4
plugins: xdist
gw0 [2] / gw1 [2] / gw2 [2]
scheduling tests via LoadScheduling
FF
================================== FAILURES ===================================
_________________________ test_something_in_parallel2 _________________________
[gw0] win32 -- Python 2.7.3 c:\Program Files (x86)\Python27\python.exe
browser = 'ff'
def test_something_in_parallel2(browser):
> raise Exception(browser)
E Exception: ff
test_something.py:6: Exception
_________________________ test_something_in_parallel1 _________________________
[gw1] win32 -- Python 2.7.3 c:\Program Files (x86)\Python27\python.exe
browser = 'ff'
def test_something_in_parallel1(browser):
> raise Exception(browser)
E Exception: ff
test_something.py:2: Exception
----------------- generated xml file: c:\temp\xdist\junit.xml -----------------
========================== 2 failed in 0.59 seconds ===========================
c:\temp\xdist
>
import pytest
def pytest_addoption(parser):
parser.addoption("--browser", action="store", default="firefox",
help="my option: firefox or explorer")
@pytest.fixture
def browser(request):
return request.config.getoption("--browser")
def test_something_in_parallel1(browser):
raise Exception(browser)
def test_something_in_parallel2(browser):
raise Exception(browser)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment