Skip to content

Commit

Permalink
Make _environment and capabilities fixtures session scoped
Browse files Browse the repository at this point in the history
  • Loading branch information
davehunt committed Aug 18, 2015
1 parent 0a305e5 commit 7815f86
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/user_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ fixture:
.. code-block:: python
import pytest
@pytest.fixture
@pytest.fixture(scope='session')
def capabilities(capabilities):
capabilities['tags'] = ['tag1', 'tag2', 'tag3']
return capabilities
Expand Down
4 changes: 2 additions & 2 deletions pytest_selenium/pytest_selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
'TestingBot']


@pytest.fixture(autouse=True)
@pytest.fixture(scope='session', autouse=True)
def _environment(request, base_url, capabilities):
"""Provide additional environment details to pytest-html report"""
config = request.config
Expand Down Expand Up @@ -63,7 +63,7 @@ def _verify_base_url(request, base_url):
', '.join(map(str, ok_codes)), base_url, response))


@pytest.fixture
@pytest.fixture(scope='session')
def capabilities(request, variables):
"""Returns combined capabilities from pytest-variables and command line"""
capabilities = variables.get('capabilities', {})
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
packages=['pytest_selenium', 'pytest_selenium.cloud'],
install_requires=[
'pytest>=2.6.4',
'pytest-html>=1.5',
'pytest-html>=1.5.1',
'pytest-variables',
'selenium>=2.26.0',
'requests'],
Expand Down
2 changes: 1 addition & 1 deletion testing/test_capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_file(testfile, testdir):
def test_fixture(testfile, testdir):
testdir.makeconftest("""
import pytest
@pytest.fixture
@pytest.fixture(scope='session')
def capabilities():
return {'foo': 'bar'}
""")
Expand Down

0 comments on commit 7815f86

Please sign in to comment.