diff --git a/CHANGES.rst b/CHANGES.rst index 835ae2c..08daf77 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,12 @@ Changelog ========= +1.7.6 +----- + +- Support pytest 3 (bubenkoff) +- Less opionated override of splinter's visit (bubenkoff) + 1.7.5 ----- diff --git a/pytest_splinter/__init__.py b/pytest_splinter/__init__.py index d7690ba..327f87a 100644 --- a/pytest_splinter/__init__.py +++ b/pytest_splinter/__init__.py @@ -1,2 +1,2 @@ """pytest-splinter package.""" -__version__ = '1.7.5' +__version__ = '1.7.6' diff --git a/pytest_splinter/plugin.py b/pytest_splinter/plugin.py index a9d5904..1ac6472 100644 --- a/pytest_splinter/plugin.py +++ b/pytest_splinter/plugin.py @@ -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) @@ -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 @@ -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: diff --git a/tests/test_plugin.py b/tests/test_plugin.py index dbe4fbb..e46ec56 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -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 diff --git a/tox.ini b/tox.ini index e1d3112..379301d 100644 --- a/tox.ini +++ b/tox.ini @@ -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