Commit Graph

3547 Commits

Author SHA1 Message Date
holger krekel 68e58e1493 add a test for robustness of capturing when a test closes FD1/2 2014-04-02 20:29:10 +02:00
holger krekel 9f7eac0ba1 Merged in msabramo/pytest/add_drone_io_to_README_rst (pull request #143)
README.rst: Add drone.io link
2014-04-02 19:13:26 +02:00
Floris Bruynooghe b0e31dca86 Mention fix for issue 453 in changelog 2014-04-02 18:00:25 +01:00
holger krekel 7d10a57514 Merged in msabramo/pytest/remove_unused_import (pull request #146)
testing/test_capture.py: Remove unused stuff for PEP8 compliance
2014-04-02 18:56:46 +02:00
Marc Abramowitz 2c0f6207e9 test_capture.py: More PEP8. Remove unused `cap` in `with`.
--HG--
branch : remove_unused_import
2014-04-02 09:48:08 -07:00
Floris Bruynooghe adb12d0d4f Escape newlines in result from assertrepr hook
The result from the pytest_assertrepr_compare hook should not include
any newlines since that will confuse the mini-formatting language used
by assertion.util.format_explanation.  So simply escape the included
newlines, this way hook writers do not have to worry about this at
all.

Fixes issue 453.
2014-04-02 17:35:22 +01:00
Floris Bruynooghe 844c141d10 Style fixes for pep8
Includes a quotation change for consistent style.
2014-04-02 17:16:37 +01:00
Marc Abramowitz 02d94e69f0 testing/test_capture.py: Remove unused `import tempfile`
--HG--
branch : remove_unused_import
2014-04-02 09:14:16 -07:00
Marc Abramowitz 1bc56f9838 README.rst: Remove drone.io build badge; keep link
hpk had concerns about the build badge confusing folks when shown on PyPI.

--HG--
branch : add_drone_io_to_README_rst
2014-04-02 06:41:33 -07:00
Jurko Gospodnetić 98ea8fae32 break reference cycles caused by storing local reference to exception info
Such reference cycles unnecessarily cause Python interpreter not to garbage
collect the objects referenced in those cycles as soon they could be collected,
and in turn cause the tests to use more memory than is strictly necessary.

--HG--
branch : break_ExceptionInfo_reference_cycles
2014-04-02 15:34:36 +02:00
holger krekel 36288c5134 fix issue493: don't run tests in doc directory with ``python setup.py test``
(use tox -e doctesting for that)
2014-04-02 12:48:35 +02:00
holger krekel 83a3cc9c94 fix issue492: avoid leak in test_writeorg. Thanks Marc Abramowitz. 2014-04-02 12:32:30 +02:00
holger krekel 0c04b44919 fix issue492: avoid leak in test_writeorg 2014-04-02 12:32:21 +02:00
Marc Abramowitz a5e8860feb README.rst: Add drone.io link and build badge image
--HG--
branch : add_drone_io_to_README_rst
2014-04-02 03:11:35 -07:00
holger krekel 8d95f89a6a fix issue496: add pytest-sugar github repo override and regen index pages, upload it. 2014-04-02 12:03:08 +02:00
holger krekel 3bca62e9e4 fix issue436: improved finding of initial conftest files from command
line arguments by using the result of parse_known_args rather than
the previous flaky heuristics.  Thanks Marc Abramowitz for tests
and initial fixing approaches in this area.
2014-04-02 11:29:23 +02:00
holger krekel 72b4534a0c add changelog entry for some PRs: improvements to pytest's own
test-suite leakage detection, courtesy of PRs from Marc Abramowitz
2014-04-02 09:51:24 +02:00
holger krekel 21b4280126 Merged in msabramo/pytest/test_writeorg_close_tempfile (pull request #136)
test_writeorg: Close a tempfile
2014-04-02 09:30:55 +02:00
holger krekel 30a9debaf1 Merged in msabramo/pytest/refactor_LsofFdLeakChecker (pull request #138)
testing/conftest.py: Refactor lsof fd leak checking
2014-04-02 09:24:16 +02:00
holger krekel 4c5718c78d Merged in msabramo/pytest/doc_plugins_pytest_sugar (pull request #141)
doc/en/plugins_index/index.txt: Update pytest-sugar
2014-04-02 09:20:42 +02:00
Marc Abramowitz c93b949878 Update entry for pytest-sugar; GitHub icon instead of BitBucket, correct description
--HG--
branch : doc_plugins_pytest_sugar
2014-04-01 18:59:42 -07:00
Marc Abramowitz cf34adb75f doc/en/plugins_index/index.txt: Update pytest-sugar
--HG--
branch : doc_plugins_pytest_sugar
2014-04-01 18:52:36 -07:00
Marc Abramowitz f824a73143 Remove cast of fd to int and sorting
Casting of fd can break for non-numeric fd (e.g.: "rtd" on Linux) and isn't
necessary since we don't need to sort.

--HG--
branch : refactor_LsofFdLeakChecker
2014-04-01 15:36:54 -07:00
Marc Abramowitz e45a33f029 testing/conftest.py: Reintialize config._openfiles for each test
And no longer need getopenfiles or config._numfiles

--HG--
branch : refactor_LsofFdLeakChecker
2014-04-01 14:13:11 -07:00
Marc Abramowitz 064e79761c Improve LsofFdLeakChecker; more reliable and useful leak checking
* Make it invoke lsof with options for machine-readable output
* Parse out file descriptor and filename from lsof output
* Draw attention to file descriptors now open that weren't open before

--HG--
branch : refactor_LsofFdLeakChecker
2014-04-01 13:41:35 -07:00
Marc Abramowitz f7713c47e8 testing/conftest.py: Refactor lsof fd leak checking
Isolate the logic into one class to make easier to understand, more maintainable.
This may aid in later plugging in an alternative implementation, such as one
that uses psutil
(https://bitbucket.org/hpk42/pytest/pull-request/137/use-psutil-to-detect-open-files-in-tests/diff)

--HG--
branch : refactor_LsofFdLeakChecker
2014-04-01 10:15:27 -07:00
holger krekel 8e4e2ba244 merge main 2014-04-01 15:06:44 +02:00
holger krekel 3b8935c533 remove dupped_stdout logic and related changes, also simplify pytest_runtest_* calls to not use a contextlib with-decorator anymore. 2014-04-01 15:03:17 +02:00
holger krekel ce8678e6d5 remove non-documented per-conftest capturing option and simplify/refactor all code accordingly. Also make capturing more robust against tests closing FD1/2 and against pdb.set_trace() calls. 2014-04-01 14:32:12 +02:00
holger krekel 2e1f6c85f6 introduce resume/suspend functionality for FDCapture and SysCapture,
fixing problems with early bailouts (from argparse's parse() function e.g.)
that wrote to stdout.
2014-04-01 14:19:58 +02:00
holger krekel ca5e6830c6 avoid some redundancy by using SysCapture from FDCapture for manipulating sys.std{out,in,err} 2014-04-01 14:19:55 +02:00
holger krekel 69cbac8fb5 rename StdCaptureBase to MultiCapture 2014-04-01 14:19:52 +02:00
Marc Abramowitz 7301981f32 test_writeorg: Close a tempfile
--HG--
branch : test_writeorg_close_tempfile
2014-03-31 08:25:35 -07:00
Marc Abramowitz 555ba4159d Simplify tests; don't use u literal not supported in py32
--HG--
branch : makepyfile_utf8
2014-03-28 12:11:33 -07:00
Marc Abramowitz f47ae74981 Make makepyfile accept UTF-8 so a few cookie tests in test_assertrewrite.py
don't need to be dedented.

--HG--
branch : makepyfile_utf8
2014-03-28 09:44:18 -07:00
holger krekel e061ace099 fix toxenv spec for py33-pexpect, thanks Daniel Grana. 2014-03-28 14:51:00 +01:00
holger krekel 85d52481b1 fix issue483: trial/py33 works now properly. Thanks Daniel Grana for PR. 2014-03-28 14:47:34 +01:00
holger krekel 47379d4a79 Merged in dangra/pytest (pull request #132)
no need for im_func and it does not exists in python3
2014-03-28 14:46:34 +01:00
Daniel Grana 0cb9d26d83 add py33-trial tox environment 2014-03-28 10:44:51 -03:00
holger krekel 95cc114b34 add changelog entry:
fix issue412: messing with stdout/stderr FD-level streams is now
captured without crashes.
2014-03-28 11:29:29 +01:00
holger krekel 9d716a39d6 fix issue412 and other encoding issues. Streamline dupfile() into
a new more thoughtful safe_text_dupfile helper.
2014-03-28 11:27:02 +01:00
holger krekel 923dcfd620 cleanup and refine issue412 test (still failing on py33) 2014-03-28 09:46:38 +01:00
holger krekel b5467645d3 merge 2014-03-28 09:27:44 +01:00
holger krekel a65380941d Merged in msabramo/pytest/sys_meta_path_remove_hook_only_if_present (pull request #133)
Only try to remove hook from sys.meta_path if it's present
2014-03-28 09:10:58 +01:00
Marc Abramowitz 17d7c60735 test_sys_meta_path_munged: Simplify with makepyfile
--HG--
branch : sys_meta_path_remove_hook_only_if_present
2014-03-28 01:03:52 -07:00
Marc Abramowitz 81f822d528 Only try to remove hook from sys.meta_path if it's present
Prevent error on exit if some code messes with sys.meta_path and removes the
assertionrewrite hook (CaptureMock seems to do this):

      File "/Users/marca/dev/hg-repos/pytest/_pytest/assertion/__init__.py", line 64, in pytest_unconfigure
        sys.meta_path.remove(hook)
    ValueError: list.remove(x): x not in list

--HG--
branch : sys_meta_path_remove_hook_only_if_present
2014-03-28 00:33:12 -07:00
holger krekel 0b340aa1f6 simplify some capturing tests 2014-03-28 07:55:07 +01:00
holger krekel 859915dc5e simplify capturing funcarg handling 2014-03-28 07:13:08 +01:00
holger krekel a8f4f49a82 simplify reset/stop_capturing and fix capturing wrt to capturing simple os.write() calls 2014-03-28 07:11:25 +01:00
holger krekel e18c3ed494 unify and normalize Sys/FD Capturing classes
* * *
more unification
2014-03-28 07:03:37 +01:00