Bruno Oliveira
72bf11cbe9
Add disabled() method to capsys and capfd
...
Fix #1599
2016-06-19 19:14:36 +02:00
palaviv
e6ff01ada3
CR fixes
2016-06-16 21:09:15 +03:00
palaviv
d21886c005
pytest.raises accpets custom message
2016-06-16 20:15:32 +03:00
Greg Price
2a3cbdf4d1
Cut a dead test helper function
...
This appears to have been unused since commit
320835d
"split out pytest-xdist related reporting to the plugin"
in July 2010. It's the only caller outside of _pytest/runner.py
of the `call_and_report` helper function there, so cutting it out
makes that more of a pure helper function and makes it slightly
easier to understand the code in _pytest/runner.py .
2016-06-15 18:26:10 -07:00
Bruno Oliveira
308396ae3c
Merge pull request #1606 from hackebrot/show-fixtures-per-test
...
Show fixtures per test
2016-06-14 09:54:18 -03:00
taschini
4d9e293b4d
Incorporated feedback ( #1597 ).
...
Fixed problem caused in a test on Windows by file left open by PyPy and not immediately garbage collected.
2016-06-14 07:12:40 +02:00
taschini
e2e6e31711
Ensure that a module within a namespace package can be found by --pyargs.
2016-06-14 07:12:40 +02:00
Raphael Pierzina
adc50ac72f
Change format for test function locations
2016-06-12 15:58:32 +01:00
Guyzmo
accd962c9f
Fixed issue shadowing error when missing argument on teardown_method
...
When the method argument is missing on teardown_method, the traceback is
100% internal to pytest, which with default options get pruned. Then
that traceback is empty, leading to a new exception as a traceback shall
not be empty.
This PR fixes that issue by pushing back the last stack on the
traceback, when the stacktrace is empty after pruning. Then the output
is still pruned, but gives meaningful information with the item where it
failed on the stack.
* fixes issue #1604
Signed-off-by: Guyzmo <guyzmo+github@m0g.net>
2016-06-12 03:45:24 +02:00
Raphael Pierzina
b47f155d74
Implement tests for --fixtures-per-test
2016-06-12 00:17:50 +01:00
Bruno Oliveira
d712428d33
Fix custom name for yield_fixtures
2016-06-08 21:07:49 -03:00
Bruno Oliveira
366879db27
Make normal fixtures work with "yield"
2016-06-08 21:07:47 -03:00
marscher
09d163aa3a
[exception handling] Fix case the current working directory (CWD) gets deleted during testing.
...
Fixes #1235 .
2016-06-08 15:18:23 +02:00
Thomas Grainger
74862b8f2f
Don't mark empty doctest files as skipped, fixes #1578
2016-06-01 19:19:14 +01:00
Ronny Pfannschmidt
b5bd4d959d
merge master to features
2016-06-01 08:13:26 +02:00
Raphael Pierzina
fb8ad714b1
Implement a test for showfixtures to show fixtures with same name
2016-05-31 11:47:16 +01:00
Ronny Pfannschmidt
158f3cfaea
merge master
2016-05-31 11:24:53 +02:00
Ronny Pfannschmidt
d217b52508
fix #510 by adding a describing skip marker on empty parameterize
2016-05-30 14:34:38 +02:00
Bruno Oliveira
8c1be624a6
Merge pull request #1554 from RonnyPfannschmidt/merge-master
...
Merge master into features
2016-05-24 11:09:33 -03:00
Bruno Oliveira
5ab5a11544
Merge pull request #1565 from tomviner/issue1544/ignore-build-dist-dirs
...
Issue 1544: norecursedirs build & dist dirs
2016-05-23 19:30:20 -03:00
TomV
d6dfb1a393
issue 1544: norecursedirs build & dist dirs
2016-05-23 21:02:29 +01:00
Ronny Pfannschmidt
85393d34b6
Merge pull request #1561 from AbdealiJK/ajk/1558_feature
...
unittest.UnitTestCase: Allow __test__ for methods
2016-05-19 10:17:28 +02:00
AbdealiJK
d4c9fa9f1a
unittest.UnitTestCase: Allow __test__ for methods
...
__test__ needs to be checked for methods of a class too. Earlier,
this was not done, and all methods in a class was assumed to be
a test. This commit adds the appropriate condition to ensure that
if the __test__ is set to False, it does not collect that method.
Fixes https://github.com/pytest-dev/pytest/issues/1558
2016-05-19 08:19:57 +05:30
Ronny Pfannschmidt
ec5e05834f
fix typo
2016-05-18 21:35:31 +02:00
Ronny Pfannschmidt
eab762ea99
Merge branch 'master' into merge-master
2016-05-13 19:37:41 +02:00
Ronny Pfannschmidt
c49863aa63
merge next chunk from master and fix changelog linting issue
2016-05-13 19:36:47 +02:00
Ronny Pfannschmidt
01d2ff804b
Merge commit '56156bb119194014129ac08c4a2c370f0b893104' into merge-master
2016-05-13 17:55:02 +02:00
John Towler
0d07b64571
Fixes Issue 1549
2016-05-05 11:29:05 -07:00
Ronny Pfannschmidt
98dd2ce75c
document reason for #1540
2016-04-28 16:22:31 +02:00
Ronny Pfannschmidt
308e76e19c
add xfailing test for #1540
2016-04-28 16:11:30 +02:00
Ronny Pfannschmidt
6cc56b4a1b
Merge pull request #1535 from palaviv/parametrize-test-ids-hook
...
introduce pytest_make_parametrize_id hook
2016-04-27 16:16:16 +02:00
palaviv
9733127951
pytest_make_parametrize_id receive config object
2016-04-26 10:23:57 +03:00
Bruno Oliveira
fdee88f086
Merge pull request #1520 from omarkohl/invalid_test_module_name
...
Raise CollectError if import test module fails
2016-04-25 21:42:41 -03:00
palaviv
b9faf78d51
Added test_pytest_make_parametrize_id
2016-04-25 17:48:28 +03:00
Omar Kohl
56855893ca
Raise CollectError if import test module fails
...
One of the reasons for failing to import the test module is invalid Python
identifiers in the full package path of the test module.
fix #1426
2016-04-23 13:50:48 +02:00
Florian Bruhin
75160547f2
Use a callable __tracebackhide__ for filtering
...
While this leads to slightly more complicated user code for the common
case (checking if the exception is of a given type) it's easier to
implement and more flexible.
2016-04-20 11:09:27 +02:00
Florian Bruhin
4c552d4ef7
Fix tests for python 2.6
2016-04-20 10:36:13 +02:00
Florian Bruhin
b607f6728f
Filter selectively with __tracebackhide__
...
When __tracebackhide__ gets set to an exception type or list/tuple of
exception types, only those exceptions get filtered, while the full
traceback is shown if another exception (e.g. a bug in a assertion
helper) happens.
2016-04-20 10:25:33 +02:00
MengJueM
1a37035d71
Add test test_absolute_win32_path
2016-04-20 01:27:37 +08:00
TomV
99c4b6fdc3
issue 1496 - xfail with condition keyword
2016-04-19 18:12:37 +01:00
Martin Prusse
7ce5873da2
Perform a "unicode aware" check for maximum recursion depth error
...
Avoid errors `UnicodeErrosr`s due non maximum recursion depth errors
when checking for those errors.
2016-04-08 23:32:18 -03:00
Ronny Pfannschmidt
0f7aeafe7c
Merge pull request #1486 from roolebo/fix-issue-138
...
Fix issue #138 - support chained exceptions
2016-04-03 19:21:57 +02:00
Bruno Oliveira
e3bc6faa2b
Merge pull request #1470 from ceridwen/features
...
Escape both bytes and unicode strings for "ids" in Metafunc.parametrize
2016-04-03 13:48:30 -03:00
Omar Kohl
c578226d43
Implement ExceptionInfo.match() to match regexp on str(exception)
...
This implements similar functionality to
unittest.TestCase.assertRegexpMatches()
closes #372
2016-04-03 11:22:44 +02:00
Ceridwen
23a8e2b469
Add .hypothesis to .gitignore and try an older version of Hypothesis for 2.6
2016-04-02 11:47:37 -04:00
Ceridwen
491b30c5d9
Add Hypothesis test for _idval and fix bug it found
2016-04-01 22:45:44 -04:00
Ceridwen
b631fc0bc1
Fix test_escaped_parametrized_names_xml
2016-04-01 21:30:45 -04:00
Tyler Goodlet
053c052190
Always lstrip() keyword expression
2016-04-01 13:10:05 -04:00
Ceridwen
9b438d56e8
Fix a test_unicode_idval_python2 (now test_unicode_idval) and associated string handling on Python 3
2016-04-01 12:27:17 -04:00
palaviv
b8c15a0215
improved idmaker name selection in case of duplicate ids
2016-03-23 00:20:58 +02:00
Quentin Pradet
653a53226a
Add strict parameter to xfail marker doc
2016-03-22 16:01:51 +04:00
Quentin Pradet
1fbd19b8cb
Fix pytest.mark.skip mark when used in strict mode
2016-03-22 15:40:34 +04:00
palaviv
7885e43b78
Merge remote-tracking branch 'upstream/features' into allow-none-as-parametrized-test-id
2016-03-20 18:57:17 +02:00
Roman Bolshakov
a736e26734
Merge remote-tracking branch 'pytest-dev/master' into fix-issue-138
2016-03-20 01:04:22 +03:00
Roman Bolshakov
fbc5ba08d9
Fix issue #138
2016-03-20 01:02:17 +03:00
palaviv
4b0237c8ee
added test for unique names when recievieng identical ids in parametrize
2016-03-19 21:42:47 +02:00
palaviv
877ca5a0bf
added test for None in paramtrized ids list
2016-03-19 21:38:24 +02:00
palaviv
a8cfd54871
added test for None in idmaker
2016-03-19 21:23:49 +02:00
Bruno Oliveira
5fcce8a7d6
Merge branch 'master' into merge-master-into-features
2016-03-18 18:26:56 -03:00
Tareq Alayan
fa6acdcfd4
junitxml: add properties node in testsuite level
...
The commit allow users to add a properties node in testsuite level see
example below:
<testsuite errors="0" failures="0" name="pytest" skips="1" tests="1"
time="11.824">
<properties>
<property name="ARCH" value="PPC"/>
<property name="OS" value="RHEL 7.2"/>
<property name="TestPlanURL" value="https://url .."/>
<property name="Automated" value="True"/>
</properties>
<testcase classname="git.....>
</testcase>
</testsuite>
The current situation is that properties node can be added to every
testcase node. However, sometimes we need some global properties that
applies to all testcases and give better description for the testsuite
itself.
2016-03-16 13:24:33 +02:00
Kale Kundert
5ceee08590
Fix CHANGELOG merge conflicts.
2016-03-14 11:55:50 -07:00
palaviv
1ee3d40dbe
allow parametrized nodes to be specified from command line
2016-03-13 23:37:21 +02:00
Kale Kundert
916c0a8b36
Fix Decimal() and __ne__() errors.
2016-03-11 16:29:18 -08:00
Kale Kundert
42a7e0488d
Properly handle inf, nan, and built-in numeric types.
...
This commit also:
- Dramatically increases the number of unit tests , mostly by borrowing
from the standard library's unit tests for math.isclose().
- Refactors approx() into two classes, one of which handles comparing
individual numbers (ApproxNonIterable) and another which uses the
first to compare individual numbers or sequences of numbers.
2016-03-11 08:49:26 -08:00
Ronny Pfannschmidt
4636bf6160
Merge pull request #1391 from malinoff/issue1342
...
LastFailed now creates .cache only when needed. Fixes #1342
2016-03-11 11:18:50 +01:00
Mike Lundy
9577120592
Allow custom fixture names for fixtures
...
When defining a fixture in the same module as where it is used, the
function argument shadows the fixture name, which a) annoys pylint and
b) can lead to bugs where you forget to request a fixture into a test
method.
This allows one to define fixtures with a different name than the name
of the function, bypassing that problem.
2016-03-09 14:58:54 -08:00
Bruno Oliveira
7a186df271
Improve error message when a plugin fails to import
2016-03-08 19:18:13 -03:00
Kale Kundert
bf97d5b817
Use the plus/minus unicode symbol in the repr string.
...
This was a challenge because it had to work in python2 and python3,
which have almost opposite unicode models, and I couldn't use the six
library. I'm also not sure the solution I found would work in python3
before python3.3, because I use the u'' string prefix which I think was
initially not part of python3.
2016-03-07 16:40:41 -08:00
Kale Kundert
dd28e28b34
Make a few stylistic improvements.
2016-03-07 10:10:54 -08:00
Kale Kundert
6f5e1e386a
Add a convenient and correct way to compare floats.
2016-03-07 10:10:54 -08:00
Ronny Pfannschmidt
6d4b14d7ee
Merge pull request #1438 from Bachmann1234/issue-1437
...
Make a good faith effort to display a bytestring when one is provided…
2016-03-06 06:48:32 +01:00
Ronny Pfannschmidt
fd0010e6e9
Merge pull request #1439 from pytest-dev/fix-1178
...
Support pytest.fail with non-ascii characters
Fixes #1178
2016-03-06 06:42:35 +01:00
Matt Bachmann
8ce32b0795
When a regex pattern contains bytes instead of a string use escape_encode to turn it into a string before further processing. Thanks @nicoddemus for the review and tips!
2016-03-05 21:04:34 -05:00
Bruno Oliveira
5d4703852e
Add test when using native strings with non-ascii chars
2016-03-05 19:34:15 -03:00
Bruno Oliveira
d8403d793f
Fix decoding issue while formatting SyntaxErrors during collection
...
This happens only in Python 2, as in Python 3 we receive
the "badline" in the exception is already properly encoded
Fix #578
2016-03-05 16:58:50 -03:00
Bruno Oliveira
24d3e01548
pytest.fail with non-ascii characters raises an internal pytest error
...
Fix #1178
2016-03-05 16:09:01 -03:00
TomV
3d2b7aeea5
issue469: junit parsing nodeid, add method test
2016-03-03 09:12:56 +00:00
TomV
28530836c9
issue469: add fix junit double colon split issue
2016-03-02 22:18:57 +00:00
Matt Williams
891e029518
Add a new doctest_namespace fixture
...
This fixture can be used to inject names into the namespace in which
your doctests run.
2016-03-02 12:43:57 +00:00
Lukas Bednar
7e758a9dc6
junit: allow multiple properties with same name
...
It might happen that test can be affected by two or more bugs.
I need to be able to track them all.
2016-02-29 16:00:26 +01:00
Florian Bruhin
c9927bb66f
Merge pull request #1414 from rygwdn/indexerror
...
catch IndexError exceptions when getting exception source location
2016-02-26 18:53:10 +01:00
Ryan Wooden
d98d655094
Simplify IndexError test.
2016-02-26 08:25:49 -04:00
Anatoly Bubenkov
cf9a09e988
catch IndexError exceptions when getting exception source location
2016-02-26 08:18:12 -04:00
Bruno Oliveira
d9ede1bac2
Add test for unconditional skip with reason
2016-02-25 20:02:34 -03:00
Bruno Oliveira
5f90907509
Fix skip/xfail markers in parametrized arguments
...
Fix #1412
2016-02-25 19:13:09 -03:00
Bruno Oliveira
96a331e32f
Display collect progress only when in a terminal
...
Fix #1397
2016-02-20 14:38:30 -02:00
Dmitry Malinovsky
e4d361b093
LastFailed now creates .cache only when needed. Fixes #1342
2016-02-16 11:42:04 +06:00
Bruno Oliveira
0eeb466f11
Fix strict xfail: it should behave exactly like xfail when a test fails
2016-02-15 19:18:48 -02:00
Bruno Oliveira
ee88679c54
Fix bug in strict xfail: test was not being actually called
2016-02-15 18:43:45 -02:00
Bruno Oliveira
7823838e69
Add strict option to xfail, making tests which XPASS to actually fail the suite
...
Fix #1355
2016-02-14 20:52:27 -02:00
Bruno Oliveira
a965386b9e
Add bool type to addini
2016-02-14 20:52:27 -02:00
Marcin Biernat
1b431d6644
fix formatting utf-8 error explanation
2016-02-12 20:28:06 +01:00
Ronny Pfannschmidt
bfa2fadac1
fix issue #1366 by showing a note on the --fulltrace option
2016-02-10 20:27:50 +01:00
Bruno Oliveira
51694b8295
Merge branch 'master' into issue1290-at-operator
2016-02-06 09:31:42 -02:00
TomV
7d107018e8
Fix #1290 : Py3.5's @ operator/assertion rewriting.
2016-02-05 23:09:57 +00:00
Ronny Pfannschmidt
de1a9f574c
merge from master
2016-02-05 00:10:28 +01:00
Georgy Dyuldin
79722ae89b
Add expected exceptions to 'DID NOT RAISE' msg
2016-02-03 14:12:41 +03:00
Bruno Oliveira
9f85d4c952
mark test_comments as xfail on pypy
...
while migrating this code it was noticed that this test was failing even
on the original py repository, so it was decided to xfail it and investigate
later
2016-01-25 23:18:04 -02:00
Bruno Oliveira
7a6f902f6f
Drop assertionnew and assertionold from _pytest._code
2016-01-25 23:18:04 -02:00
Bruno Oliveira
a912d3745b
Moved py.code code over to py.test
...
Fix #103
2016-01-25 23:18:04 -02:00