Skip to content

Commit

Permalink
Updated to work with pytest-html 1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
davehunt committed Sep 8, 2015
1 parent c740b0d commit e681ff9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
21 changes: 9 additions & 12 deletions pytest_selenium/pytest_selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,14 @@
def _environment(request, capabilities):
"""Provide additional environment details to pytest-html report"""
config = request.config
if hasattr(config, '_html'):
# add environment details to the pytest-html plugin if possible
environment = config._html.environment
environment.append(('Driver', config.option.driver))
# add capabilities to environment
environment.extend([('Capability', '{0}: {1}'.format(
k, v)) for k, v in capabilities.items()])
if config.option.driver == 'Remote':
environment.append(
('Server', 'http://{0.host}:{0.port}'.format(config.option)))
# add environment details to the pytest-html plugin
config._environment.append(('Driver', config.option.driver))
# add capabilities to environment
config._environment.extend([('Capability', '{0}: {1}'.format(
k, v)) for k, v in capabilities.items()])
if config.option.driver == 'Remote':
config._environment.append(
('Server', 'http://{0.host}:{0.port}'.format(config.option)))


@pytest.fixture(scope='session')
Expand All @@ -44,8 +42,7 @@ def base_url(request):
config = request.config
base_url = config.option.base_url or config.getini('base_url')
if base_url:
if hasattr(config, '_html'):
config._html.environment.append(('Base URL', base_url))
config._environment.append(('Base URL', base_url))
return base_url


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.1',
'pytest-html>=1.6',
'pytest-variables',
'selenium>=2.26.0',
'requests'],
Expand Down

0 comments on commit e681ff9

Please sign in to comment.