Commit Graph

68 Commits

Author SHA1 Message Date
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 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
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 53429ed8b8 Added hook to plugin docs and new CHANGELOG record 2016-04-25 18:03:34 +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 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
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 08671fcf4a Fix the changelog and dependencies for tox 2016-04-02 10:52:28 -04:00
palaviv 3ffce6ae4a Added thanks and PR links in changlog 2016-03-23 18:53:50 +02:00
palaviv 412042d987 added entry to CHANGELOG 2016-03-23 00:21:24 +02:00
Ceridwen 1f46015de5 Merge remote-tracking branch 'upstream/features' into features 2016-03-22 16:22:00 -04:00
Ceridwen 4405dd0ffe Escape both bytes and unicode strings for "ids" in Metafunc.parametrize 2016-03-22 01:31:48 -04:00
palaviv dd384f7f78 Added changlog entries 2016-03-20 19:01:47 +02:00
Roman Bolshakov 52bc2f8616 Update authors & changelog 2016-03-20 01:06:53 +03:00
Bruno Oliveira 5fcce8a7d6 Merge branch 'master' into merge-master-into-features 2016-03-18 18:26:56 -03:00
Bruno Oliveira a70e92777f Bump version to 2.9.2.dev1 2016-03-18 18:24:24 -03:00
nicoddemus 699f094b0c Finalize CHANGELOG for 2.9.1 2016-03-17 17:04:26 -04: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 981fcb2798 added CHANGELOG and AUTHORS entry 2016-03-13 23:47:41 +02:00
Kale Kundert 861265411f Add "thanks" line to the CHANGELOG. 2016-03-12 22:15:19 -08: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 4d0f066db7 Add approx() to the CHANGELOG. 2016-03-07 18:29:22 -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 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
Bruno Oliveira c2b9196a7c Merge remote-tracking branch 'upstream/master' into features 2016-03-02 23:41:56 -03:00
Bruno Oliveira 2e02a1c370 Give proper credit for PR #1428 2016-03-02 23:30:42 -03:00
TomV 28530836c9 issue469: add fix junit double colon split issue 2016-03-02 22:18:57 +00:00
Vladimir Bolshakov 0cbd58e16a Reformat versions and header levels in CHANGELOG file 2016-03-02 22:07:30 +03:00
Zearin 4bcc06362d Minor README tweaks (markup, phrasing) 2016-03-02 11:59:04 -05: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
Bruno Oliveira 316e39872a Add 2.9.1.dev1 to CHANGELOG 2016-03-01 18:55:53 -03:00
Bruno Oliveira 5a2500800d Add 2.10.0.dev1 to CHANGELOG 2016-03-01 18:54:08 -03:00
nicoddemus 7d2b65813e Fix typo in CHANGELOG 2016-02-29 16:48:28 -05:00
nicoddemus 2d7cfcd686 Finalize CHANGELOG 2016-02-29 15:42:15 -05: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
Raphael Pierzina ab90043adc Update changelog with traceback style docs fix 2016-02-27 21:07:13 +00: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 96a331e32f Display collect progress only when in a terminal
Fix #1397
2016-02-20 14:38:30 -02:00
Bruno Oliveira b76de91474 Add issue and PR GitHub templates 2016-02-18 18:26:38 -02:00