Bruno Oliveira
221f42c5ce
Change --strict help message to clarify it deals with unregistered markers
...
Fix #2444
2017-07-04 20:14:57 -03:00
Kale Kundert
8524a57075
Add "approx" to all the repr-strings.
2017-07-03 22:44:37 -07:00
Nathaniel Waisbrot
9b9fede5be
allow staticmethods to be detected as test functions
...
Allow a class method decorated `@staticmethod` to be collected as a test
function (if it meets the usual criteria).
This feature will not work in Python 2.6 -- static methods will still be
ignored there.
2017-06-29 07:44:36 -04:00
Bruno Oliveira
3de93657bd
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2017-06-24 00:47:48 -03:00
Bruno Oliveira
22b7701431
Merge pull request #2480 from nicoddemus/issue-2469-deprecated-call-ctx
...
deprecated_call context manager captures warnings already raised
2017-06-22 10:53:28 -03:00
Ronny Pfannschmidt
5e832017d5
Merge pull request #2487 from nicoddemus/recursion-error-2486
...
Fix internal error when trying to detect the start of a recursive traceback
2017-06-22 13:40:32 +02:00
Ronny Pfannschmidt
19b12b22e7
store pristine marks on function.pytestmark
...
fixes #2516
2017-06-22 10:48:45 +02:00
Kale Kundert
50769557e8
Skip the numpy doctests.
...
They seem like more trouble that they're worth.
2017-06-15 14:53:27 -07:00
Kale Kundert
8badb47db6
Implement suggestions from code review.
...
- Avoid importing numpy unless necessary.
- Mention numpy arrays and dictionaries in the docs.
- Add numpy to the list of tox dependencies.
- Don't unnecessarily copy arrays or allocate empty space for them.
- Use code from compat.py rather than writing py2/3 versions of things
myself.
- Avoid reimplementing __repr__ for built-in types.
- Add an option to consider NaN == NaN, because sometimes people use NaN
to mean "missing data".
2017-06-15 09:19:10 -07:00
Ronny Pfannschmidt
4e57a39067
Merge pull request #2468 from nicoddemus/collection-report-2464
...
Fix incorrect "collected items" report when specifying tests on the command-line
2017-06-14 10:57:57 +02:00
Ronny Pfannschmidt
af0344e940
Merge pull request #2500 from nicoddemus/issue-2434-doctest-modules
...
Fix decode error in Python 2 for doctests in docstrings
2017-06-14 05:52:44 +02:00
Bruno Oliveira
4e4ebbef5a
Improve test to ensure the expected function is re-raised
2017-06-13 20:16:48 -03:00
Bruno Oliveira
b09d60c60a
Fix decode error in Python 2 for doctests in docstrings
...
Fix #2434
2017-06-13 19:41:34 -03:00
Ryan Fitzpatrick
5a856b6e29
handle and reraise subrequest finalizer exceptions
2017-06-12 21:26:42 -04:00
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
Bruno Oliveira
8bb589fc5d
Fix internal error when trying to detect the start of a recursive traceback.
...
Fix #2486
2017-06-09 19:26:26 -03: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
620ba5971f
deprecated_call context manager captures warnings already raised
...
Fix #2469
2017-06-06 22:40:04 -03:00
Bruno Oliveira
9d41eaedbf
Issue UnicodeWarning only for non-ascii unicode
...
Fix #2463
2017-06-05 10:43:15 -03:00
Bruno Oliveira
46d157fe07
Fix collection report when collecting a single test item
2017-06-03 20:39:53 -03:00
Bruno Oliveira
87e4a28351
Fix incorrect collected items report when specifying tests on the command-line
...
Fix #2464
2017-06-03 20:39:53 -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
Katerina Koukiou
26e50f1162
junitxml: adjust junitxml output file to comply with JUnit xsd
...
Change XML file structure in the manner that failures in call and errors
in teardown in one test will appear under separate testcase elements in
the XML report.
2017-03-02 15:10:25 +01:00
Anthony Sottile
6ba3475448
Make capsys more like stdio streams in python3. Resolves #1407 .
2017-02-23 17:46:27 -08:00
Katerina Koukiou
d3a6be4130
junitxml: Fix double system-out tags per testcase
...
In the xml report we now have two occurences for the system-out tag if
the testcase writes to stdout both on call and teardown and fails in
teardown.
This behaviour is against the xsd.
This patch makes sure that the system-out section exists only
once per testcase.
2017-02-22 16:39:20 +01:00
Bruno Oliveira
82785fcd40
Use warnings.catch_warnings instead of WarningsRecorder
...
This has the benefical side-effect of not calling the original
warnings.showwarnings function, which in its original form
only writes the formatted warning to sys.stdout.
Calling the original warnings.showwarnings has the effect that nested WarningsRecorder all catch the warnings:
with WarningsRecorder() as rec1:
with WarningsRecorder() as rec2:
warnings.warn(UserWarning, 'some warning')
(both rec1 and rec2 sees the warning)
When running tests with `testdir`, the main pytest session would then see the warnings created by
the internal code being tested (if any), and the main pytest session would end up with warnings as well.
2017-02-18 13:08:14 -02:00
Bruno Oliveira
a7643a5fbe
Merge branch 'features' into integrate-pytest-warnings
2017-02-18 11:03:15 -02:00
Michal Wajszczuk
fb0b90646e
New-style classes implemented for python 2.7 - #2147
2017-02-16 20:28:17 +01:00
Bruno Oliveira
9c809f5ad0
Merge pull request #2255 from scop/spelling
...
Spelling fixes
2017-02-15 18:41:49 -02:00
Ville Skyttä
ede4e9171f
Spelling fixes
2017-02-15 17:00:58 +02:00
Bruno Oliveira
9eb1d73951
--override-ini now correctly overrides some fundamental options like "python_files"
...
#2238
2017-02-08 23:03:33 -02:00
Bruno Oliveira
6a097aa0f1
Merge branch 'master' into allow_skipping_unittests_with_pdb_active
2017-02-08 20:30:14 -02:00
Ran Benita
3a0a0c2df9
Ignore errors raised from descriptors when collecting fixtures
...
Descriptors (e.g. properties) such as in the added test case are
triggered during collection, executing arbitrary code which can raise.
Previously, such exceptions were propagated and failed the collection.
Now these exceptions are caught and the corresponding attributes are
silently ignored.
A better solution would be to completely skip access to all custom
descriptors, such that the offending code doesn't even trigger. However
I think this requires manually going through the instance and all of its
MRO for each and every attribute checking if it might be a proper
fixture before accessing it. So I took the easy route here.
In other words, putting something like this in your test class is still
a bad idea...:
@property
def innocent(self):
os.system('rm -rf /')
Fixes #2234 .
2017-02-07 14:27:34 +02:00
Vidar Tonaas Fauske
832c89dd5f
Test for `pytest.mark.xfail` with non-Python Item
2017-02-03 17:13:05 +01:00
Bruno Oliveira
abbff681ba
Fix '{0}' format for py26
2017-02-02 18:01:44 -02:00
Thomas Kriechbaumer
43662ce789
allow error message matching in pytest.raises
2017-02-02 19:52:33 +01:00
mbyt
ad56cd8027
extract a _handle_skip method, secure PY2 branch
2017-02-02 05:01:51 +01:00
mbyt
d1c725078a
Allow to skip unittests if --pdb active
...
closes #2137
2017-01-31 04:47:31 +01:00
Ronny Pfannschmidt
3b47cb45e6
Merge pull request #2222 from RonnyPfannschmidt/features
...
merge master into features
2017-01-26 13:48:10 +01:00
Ronny Pfannschmidt
713bdc1f9f
merge master into features
2017-01-26 12:00:52 +01:00
Ravi Chandra
0e58c3fa80
updates for PR review #2198
2017-01-21 16:47:49 +13:00
Ravi Chandra
c848d0a771
Pass parameter name to `make_parametrize_id` hook function
2017-01-21 16:46:45 +13:00
Ronny Pfannschmidt
e0c48b4fe7
Merge pull request #2212 from nicoddemus/pytester-rewrite
...
Assert statements of the pytester plugin again benefit from assertion rewriting
fixes #1920
2017-01-20 10:04:12 +01:00
Bruno Oliveira
7b4368f3f4
Merge pull request #2184 from eli-b/parseoutcomes-explicit-failure
...
Fail assert_outcomes() on missing terminal report
2017-01-19 21:38:54 -02:00
Bruno Oliveira
c477f09177
Assert statements of the pytester plugin again benefit from assertion rewriting
...
Fix #1920
2017-01-19 21:33:51 -02:00
Ronny Pfannschmidt
123289a88e
fixes #2208 by introducing a iteration limit
2017-01-19 11:38:15 +01:00
Bruno Oliveira
7cd7c283dd
Refactor plugin specs handling into an isolated function
2017-01-12 14:31:35 -02:00
Bruno Oliveira
043aadeaf2
Consider plugins loaded by PYTEST_PLUGINS for assertion rewrite
...
Fix #2185
2017-01-11 17:15:16 -02:00
Eli Boyarski
e18b2a427a
Fail assert_outcomes() on missing terminal report
...
Currently if the terminal report of testdir.runpytest() is missing,
assert_outcomes() on its output fails because parseoutcomes()
returns an unexpected value (None).
It's better to fail parseoutcomes() directly.
2017-01-11 17:09:37 +02:00
Jeff Widman
6d81c684cc
Switch monkeypatch fixture to yield syntax
2017-01-04 15:06:52 -08:00
Loïc Estève
7930a8373d
Newline for flake8
2017-01-03 10:57:19 -02:00
Loïc Estève
0bd8159b60
Add a test when multiple classes are specified in warns
2017-01-03 10:57:19 -02:00
Loïc Estève
6fd0394c63
pytest.warns checks for subclass relationship
...
rather than class equality. This makes it more similar to
pytest.raises.
2017-01-03 10:57:19 -02:00
Rafael Bertoldi
a9193a1531
No longer silently ignore errors in parametrize callable ids
2017-01-02 17:26:17 -02:00
Bruno Oliveira
402fbe503a
Merge branch 'master' into merge-master-into-features
2016-12-27 23:31:26 -02:00
Bruno Oliveira
091148f843
Merge pull request #2136 from hroncok/i2132
...
Tests: Check for ModuleNotFoundError on Python 3.6+
2016-12-27 23:10:58 -02:00
Bruno Oliveira
718f0b0255
Merge pull request #2130 from malinoff/fix-2129
...
Use inspect to properly detect generators. Fixes #2129
2016-12-27 22:11:46 -02:00
Bruno Oliveira
515fb09995
Move module error compatibility code to _pytest.compat
2016-12-27 22:01:22 -02:00
Miro Hrončok
1680eeb3a3
Tests: Check for ModuleNotFoundError on Python 3.6+
...
Those tests originally checked for ImportError. Since Python 3.6
ModuleNotFoundError is raised in this context instead, the tests didn't work
as they are text based (so exception inheritance does not save the day).
Fixes https://github.com/pytest-dev/pytest/issues/2132
2016-12-27 23:15:12 +01:00
Andreas Pelme
0bb8a4a36d
Fixed #2148 - parse directory names properly when args contains ::.
...
This commit also improves readbility in get_dirs_from_args by using self
documenting local functions.
get_dirs_from_args also now only returns directories that actually exists,
and not files to avoid confusion.
This commit also removes redundant checks in get_common_ancestor that
was already performed in get_dirs_from_args..
2016-12-27 15:28:56 +01:00
Loïc Estève
c5f0b751f4
Improve error message when pytest.warns fail
...
The error message contains the expected type of warnings and the
warnings that were captured. Add tests.
2016-12-20 13:45:39 +01:00
Bruno Oliveira
caee5ce489
Avoid importing asyncio directly because that in turn initializes logging ( #8 )
2016-12-13 21:54:20 -02:00
Bruno Oliveira
45eb9b566c
Move compat tests to a single file using testdir
...
This avoids having to resort to skipping modules in conftest.py file and avoids flake8 errors
2016-12-13 21:28:07 -02:00
Dmitry Malinovsky
3a59acf69f
Use inspect to properly detect generators. Fixes #2129
2016-12-11 21:59:11 +06:00
Dmitry Malinovsky
522d59e844
Use session.config.hook instead of ihook. Fixes #2124
2016-12-10 16:45:40 +06:00
Bruno Oliveira
57c4489916
Use a simple ``+-`` ASCII string in the string representation of pytest.approx In Python 2
...
Fix #2111
2016-12-02 20:01:53 -02:00
Bruno Oliveira
81528ea81f
Remove hook proxy cache
...
Fix #2016
2016-12-02 07:32:11 -02:00
Bruno Oliveira
bc0f7e6243
Fix false-positive assert rewrite warnings when using 'pytest_plugins'
...
pytest would emit false positive warnings about assertion-rewrite when a
module appears multiple times in plugins which depend
on other plugins using the 'pytest_plugins' mechanism
2016-12-01 15:50:08 -02:00
Luke Murphy
c856537e71
Add warning for incorrect passing args to `-o`.
2016-12-01 13:20:42 +01:00
Bruno Oliveira
669332b7e0
Merge pull request #2101 from wheerd/doctest-encoding
...
Added doctest encoding command line option
2016-11-30 17:43:42 -02:00
Luke Murphy
f5afd8cb54
Add missing `__test__` check for test discovery.
2016-11-30 17:05:42 +01:00
Manuel Krebber
f8fef07b4c
Fixed the tests for python 2.6
2016-11-30 14:19:07 +01:00
Manuel Krebber
c043bbb854
Changed the doctest_encoding option to an ini option.
...
Parametrized the tests for it.
2016-11-30 11:43:33 +01:00
Manuel Krebber
929912de29
Changed the tests to pass on python 2 as well.
2016-11-29 14:51:17 +01:00
Manuel Krebber
d254c6b0ae
Added some tests for --docstring-encoding option. Added option to specify encoding for internal testdir._makefile() for the tests.
2016-11-29 12:29:16 +01:00
Luke Murphy
4e1609b12e
Add `type` validation.
...
Argparse driven argument type validation is added for the
`--junit-xml` and `--confcutdir` arguments.
The commit partially reverts #2080 . Closes #2089 .
2016-11-28 02:16:01 +01:00
Bruno Oliveira
b30a6d22c5
Merge branch 'master' into merge-master-into-features
2016-11-27 17:30:40 -02:00
Luke Murphy
6c5475660a
Add test case for #595 .
...
This new test proves that reports do not capture stdout
by default when skipped.
2016-11-26 18:49:24 +01:00
Bruno Oliveira
33c0b06fdf
Fix error in approx's repr with complex numbers
...
Fix #2082
2016-11-24 15:33:12 -02:00
Bruno Oliveira
629d8e9fd6
Show an error if --confcutdir is not a valid directory
...
Fixes #2078
2016-11-23 09:49:11 -02:00
Ronny Pfannschmidt
a5b5090c72
Merge pull request #2070 from nedbat/bug2038
...
Don't fail if imp can't find the source for a .pyc file. #2038
2016-11-22 17:45:29 +01:00
Bruno Oliveira
bd343ef757
Merge remote-tracking branch 'upstream/features' into integrate-pytest-warnings
2016-11-22 14:35:39 -02:00
Bruno Oliveira
5ce551e469
Merge pull request #2075 from pytest-dev/master
...
Merge master into features after fixing flake8 errors
2016-11-22 14:10:31 -02:00
Bruno Oliveira
26ca5a702e
Add tests and integrated the original code into the core
2016-11-21 08:26:43 -02:00
Bruno Oliveira
984d4ce5ec
Fix test_excinfo_getstatement that broke because of whitespace changes
2016-11-20 19:12:42 -02:00
Bruno Oliveira
1eb5a690d4
Fix flake8 E305 and E306 errors
...
These errors started to appear with flake8-3.1.1, while they don't appear with
version 3.1.0 (weird).
2016-11-20 18:59:15 -02:00
Ned Batchelder
06bb61bbe3
Don't fail if imp can't find the source for a .pyc file. #2038
2016-11-20 13:09:32 -05:00
Bruno Oliveira
6876ba9ba6
Merge pull request #1995 from mattduck/feat/restructure-assert-truncation
...
Restructure truncation of assertion messages
2016-11-13 19:07:35 -02:00
Bruno Oliveira
efc54b2e56
Merge branch 'master' into merge-master-features
2016-11-11 18:56:53 -02:00
Bruno Oliveira
1130b9f742
Fix the stubborn test about cyclic references left by pytest.raises
...
In Python 2, a context manager's __exit__() leaves sys.exc_info with the exception values even when it was supposed
to suppress the exception, so we explicitly call sys.exc_clear() which removes the traceback and allow the object
to be released.
Also updated the test to not depend on the immediate destruction of the object but instead to ensure it is not being
tracked as a cyclic reference.
Fix #1965
2016-11-08 22:20:27 -02:00
Michael Seifert
552c7d4286
added test (thanks @nicoddemus) and added links in Changelog
2016-11-08 22:13:02 -02:00
Dan Wandschneider
e46e653794
Clean up unittest TestCase objects after tests are complete ( #1649 ).
...
Fix #1649
Users of unittest style TestCases will create expensive objects
in setUp. We should clean up TestCase instances that are lying
around so that they don't fill up memory.
2016-11-07 18:32:56 -08:00
Bruno Oliveira
006a901b86
Properly handle exceptions in multiprocessing tasks
...
Fix #1984
2016-11-03 10:48:43 -02:00
Georgy Dyuldin
e2bb4f893b
Fix teardown error message in generated xUnit XML
...
It was "test setup failure" even error happens on test teardown.
2016-11-02 15:50:32 +03:00
Mathieu Clabaut
6f93ffb5d4
Report teardown output on test failure
...
Until now, teardown stdout/stderr output was not reported upon test failure.
However such output is sometime necessary to understand the failure.
fix #442
2016-10-30 09:52:46 +01:00
Ronny Pfannschmidt
e9668d75b8
turn RecordedWarning into a namedtuple
...
fixes #2013
2016-10-24 15:23:53 +02:00
Ronny Pfannschmidt
35d154f580
Merge pull request #2011 from nicoddemus/false-rewrite-warnings
...
Fix false-positive warnings from assertion rewrite hook
2016-10-24 12:19:23 +02:00
Jason R. Coombs
f2c01c5407
Restore pexpect tests and bypass isalive/wait on macOS. Ref #2022 .
2016-10-21 12:36:42 -04:00
Jason R. Coombs
60a347aeb5
Also use flush where wait was called unconditionally
2016-10-21 12:11:35 -04:00
Jason R. Coombs
11ec96a927
Extract child flush as a staticmethod
2016-10-21 12:10:35 -04:00
Bruno Oliveira
9d00615bbf
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2016-10-20 21:51:42 -02:00
Bruno Oliveira
2a2b8cee09
Fix false-positive warnings from assertion rewrite hook
...
Fix #2005
2016-10-20 21:40:57 -02:00
Bruno Oliveira
620b384b69
Fix cmdline help message for custom options with two or more metavars
...
Fix #2004
2016-10-20 20:34:39 -02:00
Matthew Duck
acee88a118
Fix truncation tests: pyruntest() match
...
Fix issue with truncation tests for -vv and CI, where the test for
non-truncated output would return a positive match even on truncated output.
2016-10-16 20:54:51 +01:00
Bruno Oliveira
78eec0d7f8
Handle import errors with non-ascii messages when importing plugins
...
Fix #1998
2016-10-12 18:19:32 -03:00
Matthew Duck
0061d9bd3d
Fix flake8 (unused import, trailng whitespace)
2016-10-11 00:17:15 +01:00
Matthew Duck
b629da424e
Restructure truncation of assertion messages
...
This addresses ref https://github.com/pytest-dev/pytest/issues/1954 .
The current truncation for assertion explanations does not deal with long lines
properly:
- Previously if lines were too long it would display a "-n more lines"
message.
- 999e7c6541
introduced a bug where long lines can
cause index errors if there are < 10 lines.
Extract the truncation logic into its own file and ensure it can deal with
long lines properly.
2016-10-10 23:38:27 +01:00
Bruno Oliveira
a1d446b8e8
Display traceback from Import errors using pytest's short representation
...
Also omit pytest's own modules and internal libraries (py and pluggy) in low verbosity
Fix #1976
2016-10-03 21:46:44 -03:00
Bruno Oliveira
7d66e4eae1
Display full traceback from Import errors when collecting test modules
...
Fix #1976
2016-10-03 20:47:44 -03:00
Bruno Oliveira
336d7900c5
Fix test about pytest.skip message being used at global level
...
Fix #1959
2016-10-01 13:38:52 -03:00
Bruno Oliveira
654af0ba25
Merge remote-tracking branch 'upstream/master' into features
2016-09-26 19:32:53 -03:00
Bruno Oliveira
5e96edd435
Merge pull request #1952 from davidszotten/pdbcls_without_pdb_on_fail
...
Pdbcls without pdb on fail
2016-09-25 20:24:45 -03:00
Tyler Goodlet
6db2f315fa
Explain a bad scope value to the user
2016-09-21 16:40:58 -04:00
David Szotten
d75748ef6f
test for calling set_trace with custom pdb cls
2016-09-21 09:45:26 +00:00
David Szotten
c7b4b8cf6f
test
2016-09-21 09:45:23 +00:00
Lev Maximov
8cba033bbb
added a test
2016-09-20 02:47:59 +07:00
Floris Bruynooghe
887c097f8e
Merge pull request #1951 from mattduck/feat/1512-dict-compare-output
...
Feat/1512 dict compare output
2016-09-19 17:34:09 +01:00
Floris Bruynooghe
01db0f1cd1
Merge pull request #1923 from RonnyPfannschmidt/mark-internal-value
...
use consistent inner repressentation for marks
2016-09-19 15:30:22 +01:00
Matthew Duck
dd64d823b9
Don't display dict common items if verbosity=1
...
Part one of https://github.com/pytest-dev/pytest/issues/1512 .
If verbosity=1, assertion explanations are truncated at 10 lines. In this
situation, it's more important to tell the user which dictionary items are
different than which are the same.
2016-09-19 15:27:28 +01:00
Floris Bruynooghe
dc16fe2bb9
Merge junit-xml url attribute branch
...
Merge branch 'url_attr' of https://github.com/fushi/pytest into junitxml-url
2016-09-19 12:57:05 +01:00
Bruno Oliveira
04cf5e1df4
Fixed assertion rewriting for plugins in development mode
...
Fix #1934
2016-09-14 21:59:33 -03:00
Ronny Pfannschmidt
10094a3f09
use consistent inner repressentation for marks
2016-09-08 09:52:22 +02:00
Ronny Pfannschmidt
1c9bd9278e
Merge pull request #1913 from flub/builtin-assertion
...
Remove BuiltinAssertionError
2016-09-05 16:53:13 +02:00
Floris Bruynooghe
28b1896e9a
Remove BuiltinAssertionError
...
We used to have this when we where patching the real Python
AssertionError for use with reinterpret, but reinterpret is now
gone so we no longer need this as it is not used by rewrite.
2016-09-05 15:29:09 +02:00
Bruno Oliveira
1e10de574d
The "ids" argument to "parametrize" again accepts unicode strings in Python 2
...
Fixes #1905
2016-09-02 18:38:15 -03:00
mbyt
696a9112be
integrating review commets of @nicoddemus
...
plus small scale refactoring
2016-08-31 22:33:47 +02:00
mbyt
be08223d5a
Merge branch 'master' into disable_tearDown_and_cleanups_for_post_mortem_debugging
...
Conflicts:
CHANGELOG.rst
2016-08-31 20:35:31 +02:00
mbyt
10b3274924
adding corresponding test, authors and changelog
2016-08-31 20:22:54 +02:00
Bruno Oliveira
c8a366e551
Fix issue where pytest_plugins as string was marking wrong modules for rewrite
...
Fix #1888
2016-08-30 22:53:50 -03:00
Ahn Ki-Wook
856ad719d3
Fix UnicodeEncodeError when string comparison with unicode has failed.
2016-08-26 09:41:40 +09:00
John Towler
1b259f70f3
Testcase reports with a url attribute will now properly write this to junitxml
2016-08-25 13:08:51 -07:00
Jordan Guymon
a152ea2dbb
Add buffer attribute to stdin stub
2016-08-24 16:26:34 -07:00
Bruno Oliveira
972a5fb5d5
Improve error message when passing non-string ids to pytest.mark.parametrize
...
Fix #1857
2016-08-23 23:31:45 -03:00
Bruno Oliveira
df200297e2
Fix internal error when parametrizing using and empty list of ids()
...
Fix #1849
2016-08-23 18:18:46 -03:00
Bruno Oliveira
53a0e2b118
Fix code which guesses parametrized scope based on arguments
...
Fix #1832
2016-08-22 21:05:41 -03:00
Bruno Oliveira
6a8160b318
Add acceptance test for module loader
...
Related to #1837
2016-08-22 17:57:25 -03:00
Florian Bruhin
a20c3f9c44
Merge pull request #1827 from blueyed/Fix-spelling-s-outside-a-outside-of-a-
...
Fix spelling: s/outside a/outside of a/
2016-08-20 20:04:58 +02:00
Daniel Hahler
e306a53999
Fix spelling: s/outside a/outside of a/
2016-08-20 18:43:39 +02:00
Bruno Oliveira
63dc71c57e
Fix regression when using importorskip at module level
...
Fix #1822
2016-08-19 18:21:25 -03:00
Bruno Oliveira
3ba475c0f2
Move internal _is_unittest_unexpected_success_a_failure to "compat" module
...
Fix #1815
2016-08-17 22:50:10 -03:00
Bruno Oliveira
463e6572c5
Merge branch 'master' into merge-master-into-features
...
Preparing for 3.0
2016-08-17 22:39:23 -03:00
Bruno Oliveira
224ef67374
Quick fix for tests in config depended on the current directory
...
When running those tests from pytest's root folder, they would
fail because they would end up picking pytest's own pytest.ini
2016-08-17 21:32:05 -03:00
Bruno Oliveira
4ed412eb59
unittest's unexpectedSuccess should work as non-strict xpass
...
Make sure tests for that behavior obtain the same return code
using either pytest or unittest to run the same file
2016-08-17 21:32:04 -03:00
Raphael Pierzina
dfc659f781
Fix sys.version_info expression in xfail marker
2016-08-17 23:32:56 +01:00
Raphael Pierzina
0173952961
Fix py3 xfail expression evaluation and parametrize strict
2016-08-17 23:15:14 +01:00
Raphael Pierzina
767c28d422
Fix broken test in test_junitxml
2016-08-17 22:32:27 +01:00
Raphael Pierzina
d1f2f779ee
Use a better xfail reason
2016-08-17 22:31:56 +01:00
Raphael Pierzina
bb3d6d87b6
Merge branch 'master' into fix-report-outcome-for-xpass
2016-08-17 22:15:29 +01:00
Raphael Pierzina
018197d72a
Fix broken test in test_skipping and add one for strict xfail
2016-08-17 22:14:51 +01:00
Raphael Pierzina
ea379e0e4f
Fix test in test_junitxml and add one for strict
2016-08-17 22:02:54 +01:00
Florian Bruhin
789e4670e7
Merge pull request #1813 from nicoddemus/pytest-setup.cfg
...
Support [tool:pytest] in setup.cfg files
2016-08-17 20:33:57 +02:00
Florian Bruhin
c8ab79402c
Merge pull request #1811 from nicoddemus/revert-invocation-fixtures
...
Revert invocation-fixtures code
2016-08-17 20:32:54 +02:00
Bruno Oliveira
ab86dea529
Support [tool:pytest] in setup.cfg files
...
Also deprecate [pytest] usage in setup.cfg files
Fix #567
2016-08-17 08:19:38 -03:00
Bruno Oliveira
707b6b5e3f
Revert all invocation-fixtures code
...
Due to a serious regression found in #1794 , it was decided to pull off
invocation features from 3.0 so it can be (hopefully) re-introduced
in 3.1
2016-08-17 08:12:55 -03:00
Bruno Oliveira
f25771a101
Deprecate --resultlog cmdline option
...
Fix #830
2016-08-16 21:40:34 -03:00
Raphael Pierzina
55ec1d7f56
Update test_junitxml.py to interpret XPASS as passed
2016-08-15 23:58:16 +01:00
Bruno Oliveira
ca5957932b
Merge pull request #1806 from blueyed/fix-off-by-one-error-with-warnings
...
Fix off-by-one error with lines from request.node.warn
2016-08-15 19:04:00 -03:00
Daniel Hahler
c163cc7937
Improve display of continuation lines with multiline errors
...
Fixes https://github.com/pytest-dev/pytest/issues/717 .
Follow-up to https://github.com/pytest-dev/pytest/pull/1762 .
2016-08-14 22:34:31 +02:00
Daniel Hahler
16cb5d01b1
Fix off-by-one error with lines from request.node.warn
...
The line numbers in `node.location` seem to be zero-based?!
2016-08-14 22:10:01 +02:00
Daniel Hahler
5b95ee3c19
Pass exitstatus to pytest_terminal_summary hook
...
This is useful to know if a testrun has been interrupted
(EXIT_INTERRUPTED).
2016-08-14 22:06:35 +02:00
Raphael Pierzina
14a4dd0697
Extend test to verify longrepr in stdout
2016-08-12 23:31:38 +01:00
Raphael Pierzina
10a6ed1707
Update unittest test to expect failure for an unexpected success
2016-08-12 23:18:02 +01:00
Christian Boelsen
e4028b4505
Fix #1798 to include errors in total tests in junit xml output.
2016-08-08 13:35:49 +01:00
Floris Bruynooghe
99a4a1a784
Merge pull request #1791 from nicoddemus/ide-integration-1790
...
Internal adjustments for easier integration with IDEs
2016-08-07 23:50:50 +01:00
Bruno Oliveira
802755ceed
Merge remote-tracking branch 'upstream/master' into merge-master-into-features
2016-08-06 17:58:17 -03:00
Daniel Hahler
a2891420de
Fix determining rootdir from common_ancestor
2016-08-06 19:35:40 +02:00
Bruno Oliveira
1a79137d04
Add originalname attribute to Function
...
Related to #1790
2016-08-03 22:56:12 -03:00
Bruno Oliveira
ff296fd541
Add capstdout and capstderr attrs to TestReport
...
Related to #1790
2016-08-03 21:49:43 -03:00
Bruno Oliveira
08002ab75a
Add longreprtext property to TestReport objects
...
Related to #1790
2016-08-03 21:49:28 -03:00
Bruno Oliveira
6711b1d6ab
Rewrite asserts in test-modules loaded very early in the startup
...
Also now match modules which start with any of the names registered
using register_assert_rewrite as discussed in #1787
Fix #1784
2016-08-03 12:49:48 -03:00
Bruno Oliveira
277b6d3974
Sort fixture names when a fixture lookup error occurs
2016-08-02 19:45:31 -03:00
Bruno Oliveira
ea6191a0cd
Merge pull request #1779 from RonnyPfannschmidt/deselect-no-reason
...
terminal: dont pretend to know the deselection reason
2016-08-02 08:38:17 -03:00
Ronny Pfannschmidt
48f4e18280
fix deselect tests to match reason removal
2016-08-02 10:43:25 +02:00
Bruno Oliveira
553dc2600f
Strip invocation-scope suffix when displaying fixture lookup error
2016-08-01 20:34:56 -03:00
Raphael Pierzina
226f2795ba
Merge pull request #1782 from nicoddemus/invocation-fixtures-help
...
invocation-scoped fixtures show up once with --fixtures
2016-08-01 23:21:28 +01:00
Bruno Oliveira
44ecf2ab2f
invocation-scoped fixtures show up once with --fixtures
2016-08-01 18:48:29 -03:00
Bruno Oliveira
31c5194562
Fix broken test in py3k
2016-08-01 18:35:42 -03:00
satoru
3c8222f1db
Highlight the path of file location in error report
...
So that it's more obvious when we need to copy the file path.
2016-08-01 17:42:20 -03:00
Floris Bruynooghe
510a6083ba
Merge pull request #1758 from nicoddemus/deprecated-module
...
Add deprecation module to centralize deprecation messages and bits of…
2016-07-28 22:36:55 +01:00
Bruno Oliveira
ed36d627e4
Use PyInstaller for freeze test env
...
cx_freeze doesn't seem to be very well supported in Python 3.5.
Using pyinstaller instead and rename environment to "freeze" which
is a more generic term for freezing python code into standalone
executables.
Fix #1769
2016-07-26 22:02:37 -03:00
Bruno Oliveira
c2864aba3d
Merge branch 'master' into merge-master
...
# Conflicts:
# AUTHORS
# CHANGELOG.rst
# _pytest/monkeypatch.py
# _pytest/python.py
2016-07-25 19:06:29 -03:00
Bruno Oliveira
d911bfcb8a
Merge branch 'issue634-scopes' of https://github.com/Stranger6667/pytest
...
# Conflicts:
# CHANGELOG.rst
2016-07-25 18:26:50 -03:00
Bruno Oliveira
8f29ce26e9
Merge branch 'mark_missing_fixture_error' of https://github.com/eolo999/pytest
2016-07-25 18:20:17 -03:00
Bruno Oliveira
6c8b0a28e1
Add deprecation module to centralize deprecation messages and bits of code
2016-07-25 18:14:39 -03:00
Dmitry Dygalo
d72afe7e08
Fixed scope override inside metafunc.parametrize. Fixes #634
2016-07-25 12:42:50 +02:00
Roberto Polli
ab6aef1d1f
feature: default behavior now is to ignore duplicate paths specified from the command line. Use --keep-duplicates to retain duplicate paths.
2016-07-25 12:41:58 +02:00
Dmitry Dygalo
f7ad173fee
Fixed collection of classes with custom ``__new__`` method
2016-07-25 11:33:37 +02:00
Bruno Oliveira
a24146dd3c
Merge pull request #1757 from tramwaj29/improved-message-when-not-using-parametrized-variable
...
Improved message when not using parametrized variable
2016-07-24 13:02:03 -03:00
Tom Viner
42adaf5a61
Fix #1210 display msg for early calls to exit
2016-07-24 14:16:34 +02:00
JJ
4aede6faa6
fixed conflicts
2016-07-24 12:10:32 +02:00
JJ
d000f2536a
added a test for when the indirect is just a string
2016-07-24 10:47:06 +02:00
Daniel Hahler
5c5d7e05f7
Followup to #1718 : style/formatting
2016-07-24 00:21:42 +02:00
Edoardo Batini
e9a67e6702
Adjust test involving FixtureLookupErrorRepr
...
I added a starting 'E' to the expected error messages.
The tests were still passing after the previous patch but I think it's
better to have stricter tests.
2016-07-23 23:45:07 +02:00
Diego Russo
1704b7d265
Test case for overriding autouse fixtures
...
Test case for overriding autouse fixture with a parametrized fixture.
The test covers the problem explained in the issue 1601
Adding Diego Russo to AUTHORS
2016-07-23 16:53:39 +02:00
JJ
f26fa5a441
changed error message for unused parametrize name
2016-07-23 16:49:20 +02:00
Romain Dorgueil
d5a70acd48
Simplify test in test_doctest_report_none_or_only_first_failure.
2016-07-23 15:58:13 +02:00
Romain Dorgueil
e229a27e8b
using @pytest.mark.parametrize instead of calling one test many times from another as suggested by @nicoddemus in pr #1754
2016-07-23 15:21:59 +02:00
Romain Dorgueil
1a33025a76
Refactors test to be in its own class, as discussed with @nicoddemus.
2016-07-23 15:16:23 +02:00
Romain Dorgueil
fd8e019cc1
Choose the doctest output format in case of failure, still work in progress as a few checks fail (related to #1749 )
2016-07-23 14:40:46 +02:00
Bruno Oliveira
05f3422d7c
Make monkeypatch invocation-scoped
2016-07-20 22:05:49 -03:00
Bruno Oliveira
4f2bf965cb
Merge remote-tracking branch 'upstream/features' into invocation-scoped-fixtures
2016-07-20 21:16:27 -03:00
Bruno Oliveira
6aea164b6d
Add more tests for invocation scoped fixtures
2016-07-20 21:02:36 -03:00
Bruno Oliveira
e0f08a73ab
Merge branch 'features' into conftest-exception-printing
2016-07-20 19:33:36 -03:00
Ronny Pfannschmidt
3fd8257c17
add test for --maxfail=NUM overiding -x
2016-07-20 17:20:10 +02:00