-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4692 from nicoddemus/merge-master-into-features
Merge master into features
- Loading branch information
Showing
52 changed files
with
483 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Warning summary now groups warnings by message instead of by test id. | ||
|
||
This makes the output more compact and better conveys the general idea of how much code is | ||
actually generating warnings, instead of how many tests call that code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
``monkeypatch.delattr`` handles class descriptors like ``staticmethod``/``classmethod``. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Restore marks being considered keywords for keyword expressions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
``tmp_path`` fixture and other related ones provides resolved path (a.k.a real path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Copy saferepr from pylib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
``pytest_terminal_summary`` uses result from ``pytest_report_teststatus`` hook, rather than hardcoded strings. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Correctly handle ``unittest.SkipTest`` exception containing non-ascii characters on Python 2. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Python 2.7 and 3.4 support plan | ||
=============================== | ||
|
||
Python 2.7 EOL is fast approaching, with | ||
upstream support `ending in 2020 <https://legacy.python.org/dev/peps/pep-0373/#id4>`__. | ||
Python 3.4's last release is scheduled for | ||
`March 2019 <https://www.python.org/dev/peps/pep-0429/#release-schedule>`__. pytest is one of | ||
the participating projects of the https://python3statement.org. | ||
|
||
We plan to drop support for Python 2.7 and 3.4 at the same time with the release of **pytest 5.0**, | ||
scheduled to be released by **mid-2019**. Thanks to the `python_requires <https://packaging.python.org/guides/distributing-packages-using-setuptools/#python-requires>`__ ``setuptools`` option, | ||
Python 2.7 and Python 3.4 users using a modern ``pip`` version | ||
will install the last compatible pytest ``4.X`` version automatically even if ``5.0`` or later | ||
are available on PyPI. | ||
|
||
During the period **from mid-2019 and 2020**, the pytest core team plans to make | ||
bug-fix releases of the pytest ``4.X`` series by back-porting patches to the ``4.x-maintenance`` | ||
branch. | ||
|
||
**After 2020**, the core team will no longer actively back port-patches, but the ``4.x-maintenance`` | ||
branch will continue to exist so the community itself can contribute patches. The | ||
core team will be happy to accept those patches and make new ``4.X`` releases **until mid-2020**. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import sys | ||
|
||
from six.moves import reprlib | ||
|
||
|
||
class SafeRepr(reprlib.Repr): | ||
"""subclass of repr.Repr that limits the resulting size of repr() | ||
and includes information on exceptions raised during the call. | ||
""" | ||
|
||
def repr(self, x): | ||
return self._callhelper(reprlib.Repr.repr, self, x) | ||
|
||
def repr_unicode(self, x, level): | ||
# Strictly speaking wrong on narrow builds | ||
def repr(u): | ||
if "'" not in u: | ||
return u"'%s'" % u | ||
elif '"' not in u: | ||
return u'"%s"' % u | ||
else: | ||
return u"'%s'" % u.replace("'", r"\'") | ||
|
||
s = repr(x[: self.maxstring]) | ||
if len(s) > self.maxstring: | ||
i = max(0, (self.maxstring - 3) // 2) | ||
j = max(0, self.maxstring - 3 - i) | ||
s = repr(x[:i] + x[len(x) - j :]) | ||
s = s[:i] + "..." + s[len(s) - j :] | ||
return s | ||
|
||
def repr_instance(self, x, level): | ||
return self._callhelper(repr, x) | ||
|
||
def _callhelper(self, call, x, *args): | ||
try: | ||
# Try the vanilla repr and make sure that the result is a string | ||
s = call(x, *args) | ||
except Exception: | ||
cls, e, tb = sys.exc_info() | ||
exc_name = getattr(cls, "__name__", "unknown") | ||
try: | ||
exc_info = str(e) | ||
except Exception: | ||
exc_info = "unknown" | ||
return '<[%s("%s") raised in repr()] %s object at 0x%x>' % ( | ||
exc_name, | ||
exc_info, | ||
x.__class__.__name__, | ||
id(x), | ||
) | ||
else: | ||
if len(s) > self.maxsize: | ||
i = max(0, (self.maxsize - 3) // 2) | ||
j = max(0, self.maxsize - 3 - i) | ||
s = s[:i] + "..." + s[len(s) - j :] | ||
return s | ||
|
||
|
||
def saferepr(obj, maxsize=240): | ||
"""return a size-limited safe repr-string for the given object. | ||
Failing __repr__ functions of user instances will be represented | ||
with a short exception info and 'saferepr' generally takes | ||
care to never raise exceptions itself. This function is a wrapper | ||
around the Repr/reprlib functionality of the standard 2.6 lib. | ||
""" | ||
# review exception handling | ||
srepr = SafeRepr() | ||
srepr.maxstring = maxsize | ||
srepr.maxsize = maxsize | ||
srepr.maxother = 160 | ||
return srepr.repr(obj) |
Oops, something went wrong.