Commit Graph

144 Commits

Author SHA1 Message Date
Bruno Oliveira dd7112d5ea Show a few diff lines when truncating string diffs
Fix #934
2015-08-27 22:20:13 -03:00
Thomas Kluyver 4462b83258 Style fix 2015-07-16 11:04:36 -07:00
Thomas Kluyver 195422f9c0 Fix AST rewriting with starred expressions in function calls 2015-07-15 15:31:35 -07:00
Thomas Kluyver 35bea86c9f No Starred node type on Python 2 2015-07-15 14:11:21 -07:00
Matthias Bussonnier d774f3ca86 generify 2015-07-15 13:49:40 -07:00
Matthias Bussonnier 167625d24d simplify + fix 2015-07-15 13:49:40 -07:00
Matthias Bussonnier 3bc6c0f936 a test 2015-07-15 13:49:40 -07:00
Matthias Bussonnier 26e64fc45c Ast Call signature changed on 3.5
fix issue 744 on bitbucket

port of merge request 296

https://bitbucket.org/pytest-dev/pytest/pull-request/296/astcall-signature-changed-on-35
https://bitbucket.org/pytest-dev/pytest/issue/744/
2015-07-15 13:49:40 -07:00
Bruno Oliveira 7445c5bd70 Add support for PEP302 get_data API
Fix #808
2015-07-11 14:13:43 -03:00
holger krekel ee40ea5f6d Merge branch 'pytest-2.7'
Conflicts:
	AUTHORS
	_pytest/__init__.py
	setup.py
	testing/conftest.py
	tox.ini
2015-06-23 16:49:05 +02:00
Edison Gustavo Muenz 48d91def7e Added workaround to still show the diff on containers with unsortable elements.
fix issue #718
2015-06-19 07:51:59 -03:00
holger krekel ca44e88e54 backport fixed issue735
--HG--
branch : pytest-2.7
2015-06-04 07:52:25 +02:00
Benjamin Peterson f3ad2e4ad2 use NameConstant node when it exists (fixes #735)
--HG--
branch : issue735
2015-06-03 18:07:10 -05:00
Floris Bruynooghe aa2ffb9805 Merge fix for issue 731 from pytest-2.7 2015-04-30 21:13:03 +01:00
Floris Bruynooghe 7f554f50e3 Fix collapse false to look at unescaped braces only
Sometimes the repr of an object can contain the "\n{" sequence which is
used as a formatting language, so they are escaped to "\\n{".  But the
collapse-false code needs to look for the real "\n{" token instead of
simply "{" as otherwise it may get unbalanced braces from the object's
repr (sometimes caused by the collapsing of long reprs by saferepr).

Fixes issue #731.

--HG--
branch : pytest-2.7
2015-04-30 02:31:12 +01:00
holger krekel 715a235b45 remove shutdown logic from PluginManager and add a add_cleanup() API
for the already existing cleanup logic of the config object.
This simplifies lifecycle management as we don't keep two
layers of shutdown functions and also simplifies the pluginmanager
interface.

also add some docstrings.

--HG--
branch : plugin_no_pytest
2015-04-22 16:33:20 +02:00
Daniel Hahler c629f6b18b Fix `reload()` with modules handled via `python_files`
If a module exists in `sys.modules` already, `load_module` has to return it.

Fixes https://bitbucket.org/pytest-dev/pytest/issue/435

--HG--
branch : fix-reload
2015-03-04 16:21:27 +01:00
TomV f6caf230f8 fix for issue615: _format_boolop must escape %
fix test for issue615: expression must eval False

--HG--
branch : format_boolop_percent6
2014-10-27 08:57:58 +00:00
David Röthlisberger 7371d436d2 Fix assertion.rewrite on read-only filesystem 2014-10-17 21:18:37 +01:00
TomV 857db415bc fix some spelling mistakes
--HG--
branch : some_spelling_fixes
2014-10-13 23:16:26 +01:00
Anatoly Bubenkov a759da0208 Escape % character in the assertion message. closes #604 2014-10-07 01:01:21 +02:00
Anatoly Bubenkov 9a0f2a9fb7 Improve assertion failure reporting on iterables, by using ndiff and pprint. 2014-09-27 01:29:47 +00:00
holger krekel 79d2edcbff Merged in flub/pytest (pull request #207)
Show both user assertion msg as explanation (issue549)
2014-09-22 19:16:10 +02:00
Floris Bruynooghe a8dfe34bfb Merged in uweschmitt/pytest/default (pull request #194) 2014-09-05 23:57:18 +01:00
Floris Bruynooghe 7d9d502a01 Use py3k compatible .__getattr__() code
From the python-dev thread it seemed like using
object.__getattribute__(self, 'name') is the cleanest way of
implementing a class wich uses .__getattr__() and should be
pickelable.  That only works on new-style classes so this also turns
HookProxy into a new-style class on py2.

This also re-writes the test to not use cPickle so it runs on py3k.
2014-09-05 23:55:14 +01:00
Benjamin Peterson c0f091d540 remove debugging turd 2014-09-01 16:51:44 -04:00
Benjamin Peterson d4cd1aad8e improvements to rewrite cache invalidation
- stat the source path before it is read.
- Validate the source size in addition to mtime.
2014-09-01 16:51:27 -04:00
Floris Bruynooghe 37bd1e03cb Show user assertion messages and instrospection together
User provided messages, or any valid expression given as second
argument to the assert statement, are now shown in addition to the
py.test introspection details.  Formerly any user provided message
would entirely replace the introspection details.

Fixes issue549.
2014-08-23 18:14:25 +02:00
Floris Bruynooghe 79c2a47985 Improve the docstring further 2014-08-23 12:10:16 +02:00
Floris Bruynooghe e7ed45a5d4 Explain why this is important 2014-08-19 20:50:25 +02:00
Floris Bruynooghe 424479cf0f Escape newlines in repr for assertion rewriting
The assertion formatting mini-language depends on newlines being
escaped.  Unfortunately if the repr of an object contained
newlines the rewriting module did not escape those, which is now
fixed.

Fixes issue453.
2014-08-18 20:07:38 +02:00
holger krekel d16fdb378c merge PR192, streamline a bit. 2014-08-07 10:42:23 +02:00
Bruno Oliveira cc092afd3b updated CHANGELOG and trace error message as requested in review
fixes issue #437

--HG--
branch : assertionrewrite-currupted-pyc
2014-08-04 20:38:50 -03:00
Bruno Oliveira fd4485a540 Fixed assertionrewrite._read_pyc to handle corrupted pyc files properly
This seems to be the cause for issues #437 and #301.

--HG--
branch : assertionrewrite-currupted-pyc
2014-08-02 18:01:28 -03:00
Bruno Oliveira 5603a0cd4b Removing py.std usage from _pytest 2014-07-31 19:13:40 -03:00
Jurko Gospodnetić efc57391eb remove extra parentheses - stylistic code change 2014-07-17 08:35:36 +02:00
Benjamin Peterson dc65aa1fea avoid importing old assertion interpretation code by default (fixes #537) 2014-07-16 17:21:18 -07:00
Benjamin Peterson 780bdda95a assert reinterpretation: try mangling attributes that look like private class vars (fixes #514) 2014-05-31 14:37:02 -07:00
holger krekel f984e94fca Merged in jurko/pytest/break_ExceptionInfo_reference_cycles (pull request #144)
break reference cycles caused by storing local reference to exception info
2014-04-03 09:47:41 +02:00
Floris Bruynooghe adb12d0d4f Escape newlines in result from assertrepr hook
The result from the pytest_assertrepr_compare hook should not include
any newlines since that will confuse the mini-formatting language used
by assertion.util.format_explanation.  So simply escape the included
newlines, this way hook writers do not have to worry about this at
all.

Fixes issue 453.
2014-04-02 17:35:22 +01:00
Floris Bruynooghe 844c141d10 Style fixes for pep8
Includes a quotation change for consistent style.
2014-04-02 17:16:37 +01:00
Jurko Gospodnetić 98ea8fae32 break reference cycles caused by storing local reference to exception info
Such reference cycles unnecessarily cause Python interpreter not to garbage
collect the objects referenced in those cycles as soon they could be collected,
and in turn cause the tests to use more memory than is strictly necessary.

--HG--
branch : break_ExceptionInfo_reference_cycles
2014-04-02 15:34:36 +02:00
Marc Abramowitz 81f822d528 Only try to remove hook from sys.meta_path if it's present
Prevent error on exit if some code messes with sys.meta_path and removes the
assertionrewrite hook (CaptureMock seems to do this):

      File "/Users/marca/dev/hg-repos/pytest/_pytest/assertion/__init__.py", line 64, in pytest_unconfigure
        sys.meta_path.remove(hook)
    ValueError: list.remove(x): x not in list

--HG--
branch : sys_meta_path_remove_hook_only_if_present
2014-03-28 00:33:12 -07:00
Floris Bruynooghe 825ea9bfa1 Fix assertrepr for mojibake
If the compared text was in bytes and not actually valid text
(i.e. could not be encoded to text/unicode using the default encoding)
then the assertrepr would fail with an EncodingError.  This ensures
that the internal string is always valid unicode, converting any bytes
safely to valid unicode.  This is done using repr() which then needs
post-processing to fix the encompassing quotes and un-escape newlines.

This fixes issue 429.
2014-01-29 00:42:58 +00:00
Floris Bruynooghe cc1186242c Avoid wasted string concatenation and improve english 2014-01-29 00:39:04 +00:00
Jurko Gospodnetić 9fb2079458 replace py.test module references with pytest
The only remaining 'py.test' references are:
 * those referring to the 'py.test' executable
 * those in code explicitly testing py.test/pytest module compatibility
 * those in old CHANGES documentation
 * those in documentation generated based on external data
 * those in seemingly unfinished & unmaintained Japanese documentation

Minor stylistic changes and typo corrections made to documentation next to
several applied py.test --> pytest content changes.
2014-01-18 12:31:33 +01:00
holger krekel 699892bd03 fix issue409 -- better interoperate with cx_freeze by not
trying to import from collections.abc which causes problems for py27/cx_freeze.
2013-12-18 14:56:45 +01:00
holger krekel 307a41339c fix expicit assert messages for Python2.6: it turns out python2.6
instantiates the AssertionError differently for tuples.  Test
and fix to neutralize it.
2013-12-12 06:41:48 +01:00
Floris Bruynooghe e3a945a0b5 Add test for unicode assertion descriptions
Also clean up a few debugging leftovers.
2013-11-29 00:29:14 +00:00
Floris Bruynooghe a5c075c4e2 Respect unicode in AssertionError argument
This is related to issue319
2013-11-24 17:45:48 +00:00