Commit Graph

1820 Commits

Author SHA1 Message Date
Kale Kundert 9f3122fec6
Add support for numpy arrays (and dicts) to approx.
This fixes #1994.  It turned out to require a lot of refactoring because
subclassing numpy.ndarray was necessary to coerce python into calling
the right `__eq__` operator.
2017-06-11 19:27:41 -07:00
Ronny Pfannschmidt 917b9a8352 Merge pull request #2476 from nicoddemus/fix-2459-numpy-comparison
Fix internal error when a recursion error occurs and frames contain objects that can't be compared
2017-06-07 20:34:36 +02:00
Bruno Oliveira 2127a2378a Fix internal error with recursive tracebacks with that frames contain objects that can't be compared
Fix #2459
2017-06-07 14:40:13 -03:00
Bruno Oliveira 9d41eaedbf Issue UnicodeWarning only for non-ascii unicode
Fix #2463
2017-06-05 10:43:15 -03:00
Segev Finer f74f14f038 Fix --help with required options
This works by adding an argparse Action that will raise an exception in
order to skip the rest of the argument parsing. This prevents argparse
from quitting due to missing required arguments, similar to the way that
the builtin argparse --help option is implemented by raising SystemExit.

Fixes: #1999
2017-06-01 21:29:50 +03:00
Andreas Pelme ac9c8fcdab Failing test for issue #2121 2017-05-31 08:25:04 +02:00
Bruno Oliveira 1dee443c2b Merge pull request #2445 from nicoddemus/warnings-remove-filter
No longer override existing warning filters during warnings capture
2017-05-30 18:14:01 -03:00
Bruno Oliveira 32e2642233 No longer override existing warning filters during warnings capture
Fix #2430
2017-05-30 17:17:36 -03:00
Bruno Oliveira f96a1d89c5 pytest.deprecated_call now captures PendingDeprecationWarning in context manager form
Fix #2441
2017-05-30 12:52:18 -03:00
Bruno Oliveira 836dc451f4 Fix unicode issue while running doctests in Python 2
Fix #2434
2017-05-26 07:35:14 -03:00
wanghui d7a5c5716f
Add UnicodeWarning for unicode warnings in Python2 2017-05-26 13:12:02 +08:00
wanghui c39689da41
Correct warnings with unicode message. 2017-05-25 17:59:42 +08:00
Bruno Oliveira f39f416c5d Improve tests a bit
Use a normal function instead of a lambda
Parametrize test about suite name option
2017-05-12 17:52:50 -03:00
Dmitri Pribysh c9282f9e94 Transition to using ini option for suite name 2017-05-12 17:48:50 -03:00
Dmitri Pribysh fe7d89f033 Add '--junit-suite-name' CLI option 2017-05-12 17:48:50 -03:00
Bruno Oliveira f3b359f5b8 Merge remote-tracking branch 'upstream/master' into merge-master-into-features
# Conflicts:
#	_pytest/capture.py
#	_pytest/compat.py
#	_pytest/python.py
#	testing/python/collect.py
#	testing/test_mark.py
2017-05-03 19:04:53 -03:00
Vitaly Lashmanov 60b8339166 Issue #2383 - Show the correct error message when collect "parametrize" func with wrong args and add test for this case. 2017-04-29 14:32:09 +03:00
Bruno Oliveira 25371ddbfd Merge pull request #2315 from RonnyPfannschmidt/namespace-hook
remove pytest internal usage of the namespace hook
2017-04-21 16:24:20 -03:00
Kodi Arfer dcefb287fc Try not to assume a module's file extension is .py 2017-04-19 12:26:56 -07:00
Bruno Oliveira 0baf5e1499 Fix test that expected "unknown hook" error on stderr 2017-04-11 21:55:12 -03:00
Bruno Oliveira 83c508eea3 Verify hooks after collection completes
Fix #1821
2017-04-11 21:55:12 -03:00
Bruno Oliveira 78ac1bf5d1 Merge pull request #2350 from nicoddemus/future-imports-rewrite
Ensure rewritten modules don't inherit __future__ flags from pytest
2017-04-11 20:59:05 -03:00
Bruno Oliveira 1125786e78 Improve --lf/--ff test as commented during review 2017-04-11 17:55:55 -03:00
Jonas Obrist 0ab85e7a9c Changed behavior if --lf and --ff are both used.
When using both --last-failed/--lf and --failed-first/--ff pytest would
run all tests with failed tests first (as if --lf was not provied). This
patch changes it so that when using both flags, only the last failed
tests are run. This makes it easier to set --ff as the default behavior
via the config file and then selectively use --lf to only run the last
failed tests.
2017-04-10 17:46:13 +09:00
Bruno Oliveira 1b5f898dc5 Ensure rewritten modules don't inherit __future__ flags from pytest
In a recent refactoring we enabled all __future__ features in pytest
modules, but that has the unwanted side effect of propagating those
features to compile()'d modules inside assertion rewriting, unless
we pass dont_inherit=False to compile().
2017-04-06 15:00:36 -03:00
reut 333ce9849d added acceptance test for unicode plugin names 2017-04-06 10:54:47 +00:00
Bruno Oliveira 58ac4faf0c Fix exception formatting while importing test modules
Fix #2336
2017-03-29 14:43:13 -03:00
Ronny Pfannschmidt 4d31ea8316 add a comment explaining the modimport tests 2017-03-28 11:45:06 +02:00
Ronny Pfannschmidt bb750a7945 add missed file 2017-03-28 11:45:06 +02:00
Bruno Oliveira 74b54ac0ec Fix errors related to warnings raised on pypy test environment
For some reason pypy raises this warning in the line that the catch_warnings block was added:

______________________________ ERROR collecting  ______________________________
C:\ProgramData\chocolatey\lib\python.pypy\tools\pypy2-v5.4.1-win32\lib-python\2.7\pkgutil.py:476: in find_loader
    loader = importer.find_module(fullname)
c:\pytest\.tox\pypy\site-packages\_pytest\assertion\rewrite.py:75: in find_module
    fd, fn, desc = imp.find_module(lastname, path)
<builtin>/?:3: in anonymous
    ???
E   ImportWarning: Not importing directory 'c:\users\bruno\appdata\local\temp\pytest-of-Bruno\pytest-3192\testdir\test_cmdline_python_package0' missing __init__.py
2017-03-21 22:32:41 -03:00
Bruno Oliveira 916d272c44 Fix test on linux 2017-03-20 23:44:50 -03:00
Bruno Oliveira fa56114115 Clean up warnings generated by pytest's own suite 2017-03-20 22:13:17 -03:00
Bruno Oliveira 9f85584656 Merge remote-tracking branch 'upstream/features' into integrate-pytest-warnings 2017-03-20 19:59:05 -03:00
Ronny Pfannschmidt e368fb4b29 implement pytest.param
this allows a clear addition of parameterization parameters that carry along marks
instead of nesting multiple mark objects and destroying the possibility of creating
function valued parameters,
it just folders everything together into one object carrfying parameters, and the marks.
2017-03-17 16:53:43 +01:00
Bruno Oliveira 4d947077bb Fix test in py26 that expected a floor division error message 2017-03-16 23:07:03 -03:00
Bruno Oliveira e5021dc9dc Replace py.builtin.print_() calls by builtin print() function 2017-03-16 22:46:51 -03:00
Bruno Oliveira 42a5d6bdfa Add __future__ imports to all pytest modules
This prevents silly errors from creeping in Python 2 when testing in Python 3
2017-03-16 22:45:40 -03:00
Bruno Oliveira 78194093af Improve warning representation in terminal plugin and fix tests 2017-03-16 21:57:32 -03:00
Bruno Oliveira be5db6fa22 Capture warnings around the entire runtestprotocol
This is necessary for the warnings plugin to play nice with the
recwarn fixture
2017-03-16 21:54:41 -03:00
Bruno Oliveira 0baed781fe Merge remote-tracking branch 'upstream/features' into integrate-pytest-warnings 2017-03-16 20:02:06 -03:00
Bruno Oliveira 337f891d78 Fixed tests 2017-03-16 20:01:47 -03:00
Xander Johnson dc6890709e Change ValueError to io.UnsupportedOperation in capture.py. Resolves issue #2276 2017-03-14 18:55:58 -03:00
Bruno Oliveira 3c07072bfd Fix test_recwarn in Python 3.6
No longer test for implementation details of recwarn since warnings.catch_warnings has changed
significantly in 3.6.
2017-03-13 19:52:35 -03:00
Bruno Oliveira 22864b75ee Refactor recwarn to use warnings.catch_warnings instead of custom code
Since we dropped 2.5, we can now use warnings.catch_warnings to do the
"catch warnings" magic for us, simplifying the code a bit.
2017-03-13 19:28:36 -03:00
Bruno Oliveira 1e0cf5ce4d Merge remote-tracking branch 'upstream/master' into merge-master-into-features
# Conflicts:
#	AUTHORS
#	CHANGELOG.rst
#	_pytest/pytester.py
2017-03-10 15:54:05 -03:00
fbjorn cee578e327 Fix trailing whitespace in terminal output 2017-03-05 23:20:55 +03:00
Bruno Oliveira 272afa9422 Display node ids and the warnings generated by it
The rationale of using node ids is that users can copy/paste it to run a chosen test
2017-03-04 20:53:42 -03:00
Bruno Oliveira de09023e45 Also capture warnings during setup/teardown 2017-03-04 16:15:03 -03:00
Bruno Oliveira e24081bf76 Change warning output 2017-03-04 15:59:20 -03:00
Omer Hadari 6a52fe1650 fixed internal error on unprintable raised AssertionErrors 2017-03-04 10:26:46 +02:00