Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

1.7.6
-----

- Support pytest 3 (bubenkoff)
- Less opionated override of splinter's visit (bubenkoff)

1.7.5
-----

Expand Down
2 changes: 1 addition & 1 deletion pytest_splinter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""pytest-splinter package."""
__version__ = '1.7.5'
__version__ = '1.7.6'
12 changes: 8 additions & 4 deletions pytest_splinter/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
NAME_RE = re.compile(r'[\W]')


def _visit(self, url):
def _visit(self, old_visit, url):
"""Override splinter's visit to avoid unnecessary checks and add wait_until instead."""
self.driver.get(url)
old_visit(url)
self.wait_for_condition(self.visit_condition, timeout=self.visit_condition_timeout)


Expand Down Expand Up @@ -70,7 +70,7 @@ def Browser(*args, **kwargs):
if hasattr(browser, 'driver'):
browser.visit_condition = visit_condition
browser.visit_condition_timeout = visit_condition_timeout
browser.visit = functools.partial(_visit, browser)
browser.visit = functools.partial(_visit, browser, browser.visit)
browser.__splinter_browser__ = True
return browser

Expand Down Expand Up @@ -436,7 +436,11 @@ def browser_screenshot(
splinter_screenshot_encoding, splinter_screenshot_getter_png, splinter_screenshot_getter_html):
"""Make browser screenshot on test failure."""
yield
for name, value in request._funcargs.items():
for name, value in (
# pytest 3
getattr(request, '_fixture_values', {}) or
# pytest 2
getattr(request, '_funcargs', {})).items():
if hasattr(value, '__splinter_browser__'):
browser = value
if splinter_make_screenshot_on_failure and request.node.splinter_failure:
Expand Down
1 change: 0 additions & 1 deletion tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def test_status_code(browser, simple_page, splinter_webdriver):
"""Check the browser fixture."""
if splinter_webdriver == "zope.testbrowser":
pytest.skip("zope testbrowser doesn't support status code")
assert 'status_code' not in browser.__dict__
assert browser.status_code == 200


Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ basepython=python2.7
deps =
{[testenv]deps}
hg+https://bitbucket.org/pytest-dev/py#egg=py
git+https://github.com/pytest-dev/pytest.git#egg=pytest
git+https://github.com/pytest-dev/pytest.git@features#egg=pytest

[pytest]
addopts = -vvl -r w
Expand Down