Commit Graph

940 Commits

Author SHA1 Message Date
Dave Hunt 7325a5fe2e Support setting configuration using the PYTEST_ADDOPTS environment variable.
--HG--
branch : env-addopts
2015-01-23 20:09:42 +00:00
tush home 9f4d0be895 Failure message in junit xml report now are more informative
--HG--
branch : junit-verbose-failures
2015-01-20 01:45:26 +03:00
Bruno Oliveira 7e15fb7f2d Attempting to patch terminal only if terminalreporter is available
This fixes the flag "--paste=all" when running tests with xdist, as slaves would
attempt to patch a non-existing terminal during pytest_configure. Only the master
node has a terminalreporter installed.

--HG--
branch : pastebin-xdist
2015-01-19 19:20:01 -02:00
Ronny Pfannschmidt 5941b2e071 fix issue 655: crude workarounds around python2/3 exception leaks 2015-01-09 19:55:49 +01:00
James Tatum bca19a1156 Cleaning up the docstrings in monkeypatch.py 2015-01-08 17:15:22 -08:00
Floris Bruynooghe 1d15bb2880 Merged in tomviner/pytest/format_boolop_percent6 (pull request #231)
fix for issue #615: _format_boolop must escape %
2014-10-28 13:26:21 +00:00
holger krekel 959395b796 fix py26 compatibility 2014-10-27 10:02:15 +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
holger krekel f2cdbe776e bump version to 2.7 on default 2014-10-26 10:52:04 +01:00
Dinu Gherman 0c8569dcb0 Added explanation for the binary blob in runtests.py 2014-10-24 13:04:20 +02:00
holger krekel 5f2444d2a2 Merged in nicoddemus/pytest/fix-pastebin (pull request #228)
Fix --pastebin option
2014-10-23 09:08:30 +02:00
Bruno Oliveira 537dca477b Fixing --pastebin option by using a POST request instead of a XMLRPC call
fixes #614

--HG--
branch : fix-pastebin
2014-10-22 21:52:40 -02:00
Floris Bruynooghe 8d19ccb56f Merged in pfctdayelise/pytest/issue351 (pull request #161)
Fixes issue351: Add ability to specify parametrize ids as a
callable, to generate custom test ids. + tests, docs

Hg branch merge
2014-10-22 23:18:01 +01:00
holger krekel eac4514227 Merged in nicoddemus/pytest/python-classes-glob (pull request #225)
added support for glob-style patterns to python_classes and python_functions config options
2014-10-22 07:14:10 +02:00
Bruno Oliveira 0b620c304b checking that option contains glob characters before calling fnmatch
requested during code review

--HG--
branch : python-classes-glob
2014-10-20 18:36:31 -02:00
David Röthlisberger 7371d436d2 Fix assertion.rewrite on read-only filesystem 2014-10-17 21:18:37 +01:00
Bruno Oliveira b928928942 added support for glob-style patterns to python_classes and python_functions config options
fixes #600

--HG--
branch : python-classes-glob
2014-10-16 19:27:10 -03:00
TomV 857db415bc fix some spelling mistakes
--HG--
branch : some_spelling_fixes
2014-10-13 23:16:26 +01:00
Bruno Oliveira b2341899c5 Adding "auto" to help for "--tb" option 2014-10-10 20:43:33 +00:00
holger krekel b7dd8eac8e remove unused import 2014-10-09 22:45:33 +02:00
holger krekel cea9367739 Merged in HolgerPeters/pytest (pull request #221)
Make doctest flags configurable
2014-10-09 17:05:48 +02:00
holger krekel 8c91ffc701 some docs and refined semantics for wrappers 2014-10-09 12:21:01 +02:00
holger krekel c58770bfef re-scan methods during plugin register and unregister and not
during hook calling anymore.  Simplify register/getplugin api of PluginManager
2014-10-09 10:47:32 +02:00
holger krekel 04b8111f8f improve docstring, remove unused custom Exception 2014-10-09 09:55:46 +02:00
holger krekel 5999368002 remove all occurences of "__multicall__" on hook impls in pytest/*.
also simplify pytest_runtest_markereport hook in _pytest/skipping.py
while touching the code anyway.
2014-10-08 20:23:40 +02:00
Holger Peters 61caa4f776 Add documentation for doctest flags and remove dead code 2014-10-08 15:48:41 +02:00
Holger Peters f66e0825b2 Add configuration option for doctest flags 2014-10-08 14:31:17 +02:00
holger krekel c3d1986101 - refactor wrapped call support to also accomodate
pytest.mark.hookwrapper
- introduce a CallOutcome class to hold the result/excinfo status of
  calling a function.
- rename add_method_controller to add_method_wrapper
2014-10-08 11:27:14 +02:00
holger krekel b6e619413f merge pytest default 2014-10-07 18:11:15 +02:00
holger krekel 68f3818562 fix add_method_controller to deal properly in the event of exceptions.
add a docstring as well.
2014-10-07 16:16:47 +02:00
Anatoly Bubenkov a298077461 merge with default 2014-10-07 01:06:15 +02:00
Anatoly Bubenkov a759da0208 Escape % character in the assertion message. closes #604 2014-10-07 01:01:21 +02:00
holger krekel c45b7012f5 docs for "pytest_addhooks" hook. Thanks Bruno Oliveira.
updated plugin index docs.  Thanks Bruno Oliveira.

fix issue557: with "-k" we only allow the old style "-" for negation
at the beginning of strings and even that is deprecated.  Use "not" instead.
This should allow to pick parametrized tests where "-" appeared in the parameter.
2014-10-06 14:26:03 +02:00
holger krekel 767e44ef29 cleanup core collection of python methods and remove unncessary cache 2014-10-06 14:06:17 +02:00
holger krekel 818a412d29 simplify internal pytester machinery 2014-10-06 13:37:57 +02:00
holger krekel 2cb0145bce fix issue557: with "-k" we only allow the old style "-" for negation
at the beginning of strings and even that is deprecated.  Use "not" instead.
This should allow to pick parametrized tests where "-" appeared in the parameter.
2014-10-06 12:11:48 +02:00
holger krekel 3d84f35850 simplify method to record calls 2014-10-04 15:49:31 +02:00
holger krekel d8f4663f49 factor out a small "wrapping" helper 2014-10-04 15:49:31 +02:00
Dj Gilcrease a098226ee4 change the defaults from a tuple to a list so I can use config.addinivalue_line("python_files", "...") to append new options in my own plugins 2014-10-02 21:32:35 +00:00
Dj Gilcrease 05d4a3f9eb change the defaults from a tuple to a list so I can use config.addinivalue_line("norecursedirs", "...") to append new options in my own plugins 2014-10-02 21:27:19 +00:00
holger krekel 69ff29bf44 remove overhead for tracing of hook calls and remove some old unused code 2014-10-02 15:25:42 +02:00
holger krekel c7c4f62f77 optimize argument slicing when calling plugin hooks 2014-10-01 14:55:54 +02:00
holger krekel f250e912eb simplify _scan_plugin implementation and store argnames on HookCaller 2014-10-01 13:57:35 +02:00
holger krekel 28c785a0d1 call scanning of plugins directly, code is shifted from helpconfig.py to core.py 2014-10-01 12:20:11 +02:00
holger krekel ea5fb0c153 refine internal management of plugins and conftest files 2014-10-01 12:19:11 +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 49b7237581 bump version to 2.6.4.dev 2014-09-24 16:27:34 +02:00
holger krekel 2eef674615 regen and fix some docs (tox -e regen)
bump versions, depend on already released py-1.4.25
2014-09-24 14:46:56 +02:00
Floris Bruynooghe 62b8712ca9 Let xfail work on non-python Items
For some reason xfail was only implemented on non-python Item
instances.  This removes this guard which means plugins creating new
items can raise pytest.xfail.Exception and it will work as expected.
2014-09-23 23:55:26 +01:00
holger krekel be503f1c43 Merged in wosc/pytest (pull request #204)
Introduce pytest_enter_pdb hook
2014-09-23 14:04:47 +02:00
holger krekel 5abca55412 Merged in nicoddemus/pytest (pull request #203)
fix issue575: xunit-xml reporting collection errors as failures
2014-09-22 19:25:34 +02: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
David Szotten bc4eecbbac add `encoding` attr to DontReadFromInput
required by https://docs.python.org/2/library/stdtypes.html#file.encoding

and used e.g. by ipdb at _import_ time

--HG--
branch : dontreadfrominput-encoding
2014-09-22 12:19:27 +01:00
Wolfgang Schnerring 1408c9f077 Introduce pytest_enter_pdb hook 2014-09-18 14:58:42 +02:00
Bruno Oliveira 418607846a fix issue575: xunit-xml reporting collection errors as failures 2014-09-15 22:04:46 -03:00
holger krekel b6dcfd4377 fix conftest related fixture visibility issue: when running with a
CWD outside a test package pytest would get fixture discovery wrong.
Thanks to Wolfgang Schnerring for figuring out a reproducable example.

--HG--
branch : conftest-nodeid
2014-09-15 12:44:16 +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
holger krekel 09a44f4cac fix issue582: fix setuptools example, thanks Laszlo Papp and Ronny
Pfannschmidt.
2014-09-05 15:34:01 +02:00
holger krekel 7dad3cb157 prepare 2.6.2, release announcement, also add HOWTORELEASE.rst 2014-09-05 13:13:23 +02:00
holger krekel 745737e337 strike python2.5 from test code cc @flub 2014-09-05 09:50:40 +02:00
Floris Bruynooghe eae1055fb0 Merged in nocoddemus/pytest/cx_freeze-support (pull request #189) 2014-09-03 21:55:46 +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
Bruno Oliveira ccd67733fb standard lib modules no longer required in freeze_includes() and updated docs
--HG--
branch : cx_freeze-support
2014-08-11 20:20:41 -03:00
Bruno Oliveira 5873ca5146 Merging with default
--HG--
branch : cx_freeze-support
2014-08-11 20:07:11 -03:00
Bruno Oliveira d2903507d8 Moved freeze_includes() to genscript
--HG--
branch : cx_freeze-support
2014-08-11 20:03:14 -03:00
uweschmitt 224b3a2eda hopefully final fix for strange infinite recursion bug 2014-08-11 12:57:47 +02:00
uweschmitt 5d024c7433 hopefully final fix for strange infinite recursion bug 2014-08-11 12:42:36 +02:00
holger krekel e98f77037e fix issue561 example adapted to python3. 2014-08-08 15:20:37 +02:00
holger krekel e5eaf02e19 finalize pytest-2.6.1 release, regen docs 2014-08-07 21:41:51 +02:00
uweschmitt c0d1f3f7ef even better fix as replacement for last commit which was wrong 2014-08-07 17:17:05 +02:00
uweschmitt 9597d3dafe better fix as replacement for last commit 2014-08-07 16:56:45 +02:00
uweschmitt f7282b84bd fixed strange infinite recursion bug 2014-08-07 16:13:12 +02:00
holger krekel 1d7b574b31 fix issue555: just add "errors" attribute to internal Capture stream. 2014-08-07 11:05:42 +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
Floris Bruynooghe 3e875178ad Merge default 2014-08-01 23:06:24 +01:00
holger krekel 97b671057d put some imports back to function-level and streamline py2/py3 compat in one place 2014-08-01 10:12:53 +02:00
Floris Bruynooghe 4e8438afc8 Simply show the node ID for verbose output
This strips the line number, /@\d/, from the verbose output so it is
directly the node ID of the test.  This in turn means no special logic
for accepting the line number as part of the node ID is needed when
parsing the command line.
2014-08-01 00:29:35 +01:00
Bruno Oliveira 5603a0cd4b Removing py.std usage from _pytest 2014-07-31 19:13:40 -03:00
Bruno Oliveira b7b96b24d8 Docs about cx_freeze support and minor adjustments
--HG--
branch : cx_freeze-support
2014-07-30 21:50:00 -03:00
Bruno Oliveira 990e7bf3b9 first implementation and tox environment for cx-freeze support
--HG--
branch : cx_freeze-support
2014-07-30 19:16:51 -03:00
Anatoly Bubenkov 8ff8dd3ae9 Merged in fix_initial_parsing (pull request #186)
Fix issue544 and fix another issue with parsing ``::``
2014-07-28 14:16:02 +02:00
holger krekel 83e0b52294 speedup @ replacement for the massive lists from pytest-bdd :)
--HG--
branch : fix_initial_parsing
2014-07-28 13:53:53 +02:00
holger krekel 1265612465 fix issue547 2.6 regression: capsys/capfd now work again when output capturing ("-s") is disabled. 2014-07-28 13:17:37 +02:00
holger krekel 40eed363e8 fix issue544 by only removing "@NUM" at the end of a part (parts are
separated by "::") and if the part has an .py extension.

--HG--
branch : fix_initial_parsing
2014-07-28 12:07:15 +02:00
holger krekel 5ccd3f2fc5 fix conftest detection if commandline arguments contain "::" syntax
--HG--
branch : fix_initial_parsing
2014-07-28 11:48:37 +02:00
holger krekel ba878c6d9d add changelog entry and refactor unittest.mock.patch fix a bit 2014-07-28 10:34:01 +02:00
holger krekel 8792261df1 Merged in ticosax/pytest/mock-unittest-252 (pull request #184)
Injection of fixture doesn't work when decorated with unittest.mock.patch
2014-07-28 10:31:31 +02:00
holger krekel c2ed29070a address issue170 by merging David Mohr's PR on adding "raises" as an optional
argument to pytest.mark.xfail.
2014-07-28 09:59:22 +02:00
Nicolas Delaby 2e55c4ba61 unittest.mock from stdlib should come last
--HG--
branch : mock-unittest-252
2014-07-27 12:11:39 +02:00
Nicolas Delaby e6ad6e02d2 Handle also unittest.mock
Move handling in dedicated function to isolate its logic

--HG--
branch : mock-unittest-252
2014-07-27 10:43:50 +02:00
david@mcbf.net 6a4492a22d isinstance() on exception value instead of comparing types, consolidate tests
--HG--
branch : xfail-cause
2014-07-26 17:46:50 +02:00
david@mcbf.net 7b273b8577 Add mark.xfail argument raises so that unexpected exceptions show up as test failures.
--HG--
branch : xfail-cause
2014-07-26 15:11:05 +02:00