Commit Graph

1762 Commits

Author SHA1 Message Date
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