Benjamin Peterson
fd9055fd11
fix test on Python 3.2
2014-05-31 14:51:05 -07:00
Benjamin Peterson
780bdda95a
assert reinterpretation: try mangling attributes that look like private class vars ( fixes #514 )
2014-05-31 14:37:02 -07:00
holger krekel
d6281b4206
- restore compatibility to old getvalueorskip behaviour
...
- introduce a better NOTSET representation to improve docs
2014-05-14 07:36:31 +02:00
Floris Bruynooghe
c47835f5ec
Merge pull request #158 , fixes issue 504
2014-04-15 11:43:38 -04:00
Floris Bruynooghe
faba432996
Improve error message if pytest.raises is used wrongly
...
If the type is not checked then an incomprehensible error will occur
later. This enforces the type and raies the same exception/msg as
CPython does in that case.
Docstring unmodified, just re-justified for pep8 compat.
2014-04-14 18:09:10 -04:00
Andy Freeland
2ba23e8d08
issue504: verbose output displays node IDs for each test
...
Replace the verbose per-test reporting format of `file:line test_name RESULT`
with the node ID of the test, i.e. `file@line::class::method[param] RESULT`.
This patch does not update the examples in the docs; @hpk42 has a script
to regenerate those.
--HG--
branch : issue504
2014-04-14 17:42:02 -04:00
holger krekel
15af7e1662
fix tests to properly fail on failed collectiosn (which was hiding an error)
...
and also implement __test__=False for test functions properly.
--HG--
branch : nose_test_attr
2014-04-10 13:37:39 +02:00
holger krekel
e42cbc714f
fix wrong merge
...
--HG--
branch : nose_test_attr
2014-04-10 12:58:10 +02:00
holger krekel
494be731e3
support nose-style ``__test__`` attribute on modules, classes and
...
functions, including unittest-style Classes. If set to True, the
test will not be collected.
--HG--
branch : nose_test_attr
2014-04-10 12:46:27 +02:00
holger krekel
f91049cec9
fix issue473: work around mock putting an unbound method into a class
...
dict when double-patching.
--HG--
branch : issue473
2014-04-08 12:50:13 +02:00
holger krekel
ef7cb47b1e
fix issue498: if a fixture finalizer fails, make sure that the fixture
...
is still invalidated.
--HG--
branch : issue498
2014-04-07 13:29:57 +02:00
holger krekel
cbe31f3748
Merged in msabramo/pytest/makepyfile_utf8 (pull request #134 )
...
Make makepyfile accept UTF-8 so a few cookie tests in test_assertrewrite.py
2014-04-03 10:00:24 +02:00
Anatoly Bubenkov
b4fe91943d
Merged in hpk42/pytest-hpk/conftest-clean (pull request #148 )
...
cleanup internal conftest handling and avoid the strange None entry in the conftest cache.
2014-04-03 09:38:47 +02:00
holger krekel
0365e5c3a0
cleanup internal conftest handling and avoid the strange None entry in the conftest cache.
...
(There is basically no reason to ask for conftestmodules without specifying a path.)
--HG--
branch : conftest-clean
2014-04-02 22:30:45 +02:00
holger krekel
e6859406f1
fix test on py33, thanks msabramo1
2014-04-02 20:49:57 +02:00
holger krekel
51cff6f106
fix issue486: better reporting and handling of early conftest loading failures
...
--HG--
branch : issue486
2014-04-02 20:42:41 +02:00
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
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
Marc Abramowitz
02d94e69f0
testing/test_capture.py: Remove unused `import tempfile`
...
--HG--
branch : remove_unused_import
2014-04-02 09:14:16 -07:00
holger krekel
0c04b44919
fix issue492: avoid leak in test_writeorg
2014-04-02 12:32:21 +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
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
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
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
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
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
holger krekel
2263fcf6b7
remove unused "suspend/resume" on capturing, some formatting cleanup
2014-03-28 07:03:34 +01:00
Ronny Pfannschmidt
2b2c1e5b7b
condition for python3 of the xfailing test for 412
2014-03-27 14:01:38 +01:00
holger krekel
7b63fa5966
merge in current default
2014-03-27 13:57:54 +01:00
Ronny Pfannschmidt
b18040337a
xfailing test for issue 412
2014-03-27 13:53:59 +01:00
holger krekel
bb0632c7ad
extend test
2014-03-26 19:37:49 +01:00