Skip to content

Feature master merge #1674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
6359e75
Trivial spelling fix in runtest_setup.py
The-Compiler Jun 22, 2016
df9918e
issue1625, name getfuncargvalue to getfixturevalue
tomviner Jun 21, 2016
3d263c6
Merge pull request #1626 from tomviner/issue1625/rename-getfuncargvalue
nicoddemus Jun 24, 2016
77689eb
Fixes #1503 no longer collapse false explanations
tomviner Jun 24, 2016
ea5bda0
remove links to funding campaign
pfctdayelise Jun 24, 2016
62255d8
rm global header
pfctdayelise Jun 24, 2016
7612b65
update sprint page to be past tense
pfctdayelise Jun 24, 2016
0c63762
Merge pull request #1654 from tomviner/issue1503/remove_collapse_false
nicoddemus Jun 24, 2016
939407e
Simplify Argument.__repr__
blueyed Jun 22, 2016
757f37f
Don't ignore ImportError with setuptools plugins
The-Compiler May 23, 2016
05b5554
Renamed pytest pdb to debugging which conflicts with python pdb.
Jun 25, 2016
9a5224e
Renamed the pdb module and changed unit tests accordingly
Jun 25, 2016
70ea3ce
Merge pull request #1564 from The-Compiler/issue1479
RonnyPfannschmidt Jun 25, 2016
ce603dc
Add changelog entry for #1564
The-Compiler Jun 25, 2016
7eb1318
Merge pull request #1656 from pytest-dev/rm-indiegogo-links
nicoddemus Jun 25, 2016
df17f86
Merge pull request #1648 from blueyed/simplify-Argument-__repr__
nicoddemus Jun 25, 2016
e024214
Merge pull request #1666 from pytest-dev/1564-changelog
nicoddemus Jun 25, 2016
c519b95
Merge pull request #1663 from aostr/master
nicoddemus Jun 25, 2016
9e49ac0
Merge branch 'master' into feature_master_merge
hpk42 Jun 25, 2016
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
20 changes: 20 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,30 @@
* Add proposal to docs for a new feature that enables users to combine multiple
fixtures into one. Thanks to `@hpk42`_ and `@hackebrot`_.

* Rename ``getfuncargvalue`` to ``getfixturevalue``. ``getfuncargvalue`` is
deprecated but still present. Thanks to `@RedBeardCode`_ and `@tomviner`_
for PR (`#1626`_).

* Always include full assertion explanation. The previous behaviour was hiding
sub-expressions that happened to be False, assuming this was redundant information.
Thanks `@bagerard`_ for reporting (`#1503`_). Thanks to `@davehunt`_ and
`@tomviner`_ for PR.

* Renamed the pytest ``pdb`` module (plugin) into ``debugging``.

*

* ImportErrors in plugins now are a fatal error instead of issuing a
pytest warning (`#1479`_). Thanks to `@The-Compiler`_ for the PR.

.. _#1580: https://github.com/pytest-dev/pytest/pull/1580
.. _#1605: https://github.com/pytest-dev/pytest/issues/1605
.. _#1597: https://github.com/pytest-dev/pytest/pull/1597
.. _#460: https://github.com/pytest-dev/pytest/pull/460
.. _#1553: https://github.com/pytest-dev/pytest/issues/1553
.. _#1626: https://github.com/pytest-dev/pytest/pull/1626
.. _#1503: https://github.com/pytest-dev/pytest/issues/1503
.. _#1479: https://github.com/pytest-dev/pytest/issues/1479

.. _@graingert: https://github.com/graingert
.. _@taschini: https://github.com/taschini
Expand All @@ -166,6 +183,9 @@
``--continue-on-collection-errors`` option to restore previous behaviour.
Thanks `@olegpidsadnyi`_ and `@omarkohl`_ for the complete PR (`#1628`_).

.. _@bagerard: https://github.com/bagerard
.. _@davehunt: https://github.com/davehunt


*

Expand Down
33 changes: 0 additions & 33 deletions _pytest/assertion/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,44 +38,11 @@ def format_explanation(explanation):
displaying diffs.
"""
explanation = ecu(explanation)
explanation = _collapse_false(explanation)
lines = _split_explanation(explanation)
result = _format_lines(lines)
return u('\n').join(result)


def _collapse_false(explanation):
"""Collapse expansions of False

So this strips out any "assert False\n{where False = ...\n}"
blocks.
"""
where = 0
while True:
start = where = explanation.find("False\n{False = ", where)
if where == -1:
break
level = 0
prev_c = explanation[start]
for i, c in enumerate(explanation[start:]):
if prev_c + c == "\n{":
level += 1
elif prev_c + c == "\n}":
level -= 1
if not level:
break
prev_c = c
else:
raise AssertionError("unbalanced braces: %r" % (explanation,))
end = start + i
where = end
if explanation[end - 1] == '\n':
explanation = (explanation[:start] + explanation[start+15:end-1] +
explanation[end+1:])
where -= 17
return explanation


def _split_explanation(explanation):
"""Return a list of individual lines in the explanation

Expand Down
24 changes: 9 additions & 15 deletions _pytest/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class UsageError(Exception):
_preinit = []

default_plugins = (
"mark main terminal runner python pdb unittest capture skipping "
"mark main terminal runner python debugging unittest capture skipping "
"tmpdir monkeypatch recwarn pastebin helpconfig nose assertion genscript "
"junitxml resultlog doctest cacheprovider setuponly setupplan").split()

Expand Down Expand Up @@ -655,20 +655,17 @@ def _set_opt_strings(self, opts):
self._long_opts.append(opt)

def __repr__(self):
retval = 'Argument('
args = []
if self._short_opts:
retval += '_short_opts: ' + repr(self._short_opts) + ', '
args += ['_short_opts: ' + repr(self._short_opts)]
if self._long_opts:
retval += '_long_opts: ' + repr(self._long_opts) + ', '
retval += 'dest: ' + repr(self.dest) + ', '
args += ['_long_opts: ' + repr(self._long_opts)]
args += ['dest: ' + repr(self.dest)]
if hasattr(self, 'type'):
retval += 'type: ' + repr(self.type) + ', '
args += ['type: ' + repr(self.type)]
if hasattr(self, 'default'):
retval += 'default: ' + repr(self.default) + ', '
if retval[-2:] == ', ': # always long enough to test ("Argument(" )
retval = retval[:-2]
retval += ')'
return retval
args += ['default: ' + repr(self.default)]
return 'Argument({0})'.format(', '.join(args))


class OptionGroup:
Expand Down Expand Up @@ -927,10 +924,7 @@ def _preparse(self, args, addopts=True):
args[:] = self.getini("addopts") + args
self._checkversion()
self.pluginmanager.consider_preparse(args)
try:
self.pluginmanager.load_setuptools_entrypoints("pytest11")
except ImportError as e:
self.warn("I2", "could not load setuptools entry import: %s" % (e,))
self.pluginmanager.load_setuptools_entrypoints("pytest11")
self.pluginmanager.consider_env()
self.known_args_namespace = ns = self._parser.parse_known_args(args, namespace=self.option.copy())
if self.known_args_namespace.confcutdir is None and self.inifile:
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions _pytest/doctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ def __init__(self, name, parent, runner=None, dtest=None):
def setup(self):
if self.dtest is not None:
self.fixture_request = _setup_fixtures(self)
globs = dict(getfixture=self.fixture_request.getfuncargvalue)
for name, value in self.fixture_request.getfuncargvalue('doctest_namespace').items():
globs = dict(getfixture=self.fixture_request.getfixturevalue)
for name, value in self.fixture_request.getfixturevalue('doctest_namespace').items():
globs[name] = value
self.dtest.globs.update(globs)

Expand Down
27 changes: 17 additions & 10 deletions _pytest/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import sys
import math
import collections
import warnings

import py
import pytest
Expand Down Expand Up @@ -1855,7 +1856,7 @@ def _getnextfixturedef(self, argname):
fixturedefs = self._arg2fixturedefs.get(argname, None)
if fixturedefs is None:
# we arrive here because of a a dynamic call to
# getfuncargvalue(argname) usage which was naturally
# getfixturevalue(argname) usage which was naturally
# not known at parsing/collection time
fixturedefs = self._fixturemanager.getfixturedefs(
argname, self._pyfuncitem.parent.nodeid)
Expand Down Expand Up @@ -1950,7 +1951,7 @@ def _fillfixtures(self):
fixturenames = getattr(item, "fixturenames", self.fixturenames)
for argname in fixturenames:
if argname not in item.funcargs:
item.funcargs[argname] = self.getfuncargvalue(argname)
item.funcargs[argname] = self.getfixturevalue(argname)

def cached_setup(self, setup, teardown=None, scope="module", extrakey=None):
""" (deprecated) Return a testing resource managed by ``setup`` &
Expand Down Expand Up @@ -1984,17 +1985,23 @@ def finalizer():
self._addfinalizer(finalizer, scope=scope)
return val

def getfuncargvalue(self, argname):
""" Dynamically retrieve a named fixture function argument.
def getfixturevalue(self, argname):
""" Dynamically run a named fixture function.

As of pytest-2.3, it is easier and usually better to access other
fixture values by stating it as an input argument in the fixture
function. If you only can decide about using another fixture at test
Declaring fixtures via function argument is recommended where possible.
But if you can only decide whether to use another fixture at test
setup time, you may use this function to retrieve it inside a fixture
function body.
or test function body.
"""
return self._get_active_fixturedef(argname).cached_result[0]

def getfuncargvalue(self, argname):
""" Deprecated, use getfixturevalue. """
warnings.warn(
"use of getfuncargvalue is deprecated, use getfixturevalue",
DeprecationWarning)
return self.getfixturevalue(argname)

def _get_active_fixturedef(self, argname):
try:
return self._fixturedefs[argname]
Expand All @@ -2010,7 +2017,7 @@ class PseudoFixtureDef:
raise
# remove indent to prevent the python3 exception
# from leaking into the call
result = self._getfuncargvalue(fixturedef)
result = self._getfixturevalue(fixturedef)
self._funcargs[argname] = result
self._fixturedefs[argname] = fixturedef
return fixturedef
Expand All @@ -2026,7 +2033,7 @@ def _get_fixturestack(self):
l.append(fixturedef)
current = current._parent_request

def _getfuncargvalue(self, fixturedef):
def _getfixturevalue(self, fixturedef):
# prepare a subrequest object before calling fixture function
# (latter managed by fixturedef)
argname = fixturedef.argname
Expand Down
14 changes: 0 additions & 14 deletions doc/en/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
{% extends "!layout.html" %}
{% block header %}
<div align="center" xmlns="http://www.w3.org/1999/html" style="background-color: lightgreen; padding: .5em">
<h4>
Want to help improve pytest? Please
<a href="https://www.indiegogo.com/projects/python-testing-sprint-mid-2016#/">
contribute to
</a>
or
<a href="announce/sprint2016.html">
join
</a>
our upcoming sprint in June 2016!

</h4>
</div>
{{super()}}
{% endblock %}
{% block footer %}
Expand Down
5 changes: 0 additions & 5 deletions doc/en/_templates/links.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<h3>Useful Links</h3>
<ul>
<li>
<a href="https://www.indiegogo.com/projects/python-testing-sprint-mid-2016#/">
<b>Sprint funding campaign</b>
</a>
</li>
<li><a href="{{ pathto('index') }}">The pytest Website</a></li>
<li><a href="{{ pathto('contributing') }}">Contribution Guide</a></li>
<li><a href="https://pypi.python.org/pypi/pytest">pytest @ PyPI</a></li>
Expand Down
77 changes: 17 additions & 60 deletions doc/en/announce/sprint2016.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ python testing sprint June 20th-26th 2016
.. image:: ../img/freiburg2.jpg
:width: 400

The pytest core group is heading towards the biggest sprint
in its history, to take place in the black forest town Freiburg
in Germany. As of February 2016 we have started a `funding
The pytest core group held the biggest sprint
in its history in June 2016, taking place in the black forest town Freiburg
in Germany. In February 2016 we started a `funding
campaign on Indiegogo to cover expenses
<http://igg.me/at/pytest-sprint/x/4034848>`_ The page also mentions
some preliminary topics:
Expand Down Expand Up @@ -35,73 +35,30 @@ some preliminary topics:
Participants
--------------

Here are preliminary participants who said they are likely to come,
given some expenses funding::

Anatoly Bubenkoff, Netherlands
Ana Ribeiro, Brazil
Andreas Pelme, Personalkollen, Sweden
Anthony Wang, Splunk, US
Brianna Laugher, Australia
Bruno Oliveira, Brazil
Danielle Jenkins, Splunk, US
Dave Hunt, UK
Florian Bruhin, Switzerland
Floris Bruynooghe, Cobe.io, UK
Holger Krekel, merlinux, Germany
Oliver Bestwalter, Avira, Germany
Omar Kohl, Germany
Raphael Pierzina, FanDuel, UK
Ronny Pfannschmidt, Germany
Tom Viner, UK

<your name here?>

Other contributors and experienced newcomers are invited to join as well
but please send a mail to the pytest-dev mailing list if you intend to
do so somewhat soon, also how much funding you need if so. And if you
are working for a company and using pytest heavily you are welcome to
join and we encourage your company to provide some funding for the
sprint. They may see it, and rightfully so, as a very cheap and deep
training which brings you together with the experts in the field :)
Over 20 participants took part from 4 continents, including employees
from Splunk, Personalkollen, Cobe.io, FanDuel and Dolby. Some newcomers
mixed with developers who have worked on pytest since its beginning, and
of course everyone in between.


Sprint organisation, schedule
-------------------------------

tentative schedule:
People arrived in Freiburg on the 19th, with sprint development taking
place on 20th, 21st, 22nd, 24th and 25th. On the 23rd we took a break
day for some hot hiking in the Black Forest.

- 19/20th arrival in Freiburg
- 20th social get together, initial hacking
- 21/22th full sprint days
- 23rd break day, hiking
- 24/25th full sprint days
- 26th departure
Sprint activity was organised heavily around pairing, with plenty of group
discusssions to take advantage of the high bandwidth, and lightning talks
as well.

We might adjust according to weather to make sure that if
we do some hiking or excursion we'll have good weather.
Freiburg is one of the sunniest places in Germany so
it shouldn't be too much of a constraint.


Accomodation
----------------

We'll see to arrange for renting a flat with multiple
beds/rooms. Hotels are usually below 100 per night.
The earlier we book the better.

Money / funding
---------------

The Indiegogo campaign asks for 11000 USD which should cover
the costs for flights and accomodation, renting a sprint place
and maybe a bit of food as well.

If your organisation wants to support the sprint but prefers
to give money according to an invoice, get in contact with
holger at http://merlinux.eu who can invoice your organisation
properly.
The Indiegogo campaign aimed for 11000 USD and in the end raised over
12000, to reimburse travel costs, pay for a sprint venue and catering.

If we have excess money we'll use for further sprint/travel
funding for pytest/tox contributors.
Excess money is reserved for further sprint/travel funding for pytest/tox
contributors.
2 changes: 1 addition & 1 deletion doc/en/genapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def docmethod(self, method):

def pytest_funcarg__a(request):
with Writer("request") as writer:
writer.docmethod(request.getfuncargvalue)
writer.docmethod(request.getfixturevalue)
writer.docmethod(request.cached_setup)
writer.docmethod(request.addfinalizer)
writer.docmethod(request.applymarker)
Expand Down
4 changes: 2 additions & 2 deletions testing/code/test_excinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ class TestFormattedExcinfo:
def pytest_funcarg__importasmod(self, request):
def importasmod(source):
source = _pytest._code.Source(source)
tmpdir = request.getfuncargvalue("tmpdir")
tmpdir = request.getfixturevalue("tmpdir")
modpath = tmpdir.join("mod.py")
tmpdir.ensure("__init__.py")
modpath.write(source)
Expand Down Expand Up @@ -1077,4 +1077,4 @@ def test(tmpdir):
""")
result = testdir.runpytest()
result.stdout.fnmatch_lines(['* 1 failed in *'])
assert 'INTERNALERROR' not in result.stdout.str() + result.stderr.str()
assert 'INTERNALERROR' not in result.stdout.str() + result.stderr.str()
6 changes: 3 additions & 3 deletions testing/cx_freeze/runtests_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import pytest

setup(
name="runtests",
version="0.1",
description="exemple of how embedding pytest into an executable using cx_freeze",
name="runtests",
version="0.1",
description="example of how embedding pytest into an executable using cx_freeze",
executables=[Executable("runtests_script.py")],
options={"build_exe": {'includes': pytest.freeze_includes()}},
)
Expand Down
Loading