holger krekel
f28f073c7c
fix teardown-ordering for parametrized setups/teardowns
2012-10-22 12:16:54 +02:00
holger krekel
036557ac18
fix issue206 - unset PYTHONDONTWRITEBYTECODE in assertrewrite test
2012-10-22 11:14:18 +02:00
holger krekel
1b61fbc8ed
- fix test_nose.py by being more tolerant about the error message
...
(differs between py32 and py33, thanks Arfrever)
- use pypi again now that py is released
2012-10-22 10:55:59 +02:00
holger krekel
97f03edcd6
fix issue205 - nested conftest to pickup pycollect_makemodule - relates to the two
...
reports of a failing doc/en/example/py2py3.
2012-10-22 10:17:50 +02:00
holger krekel
d4d213f83d
some more fixes
2012-10-20 14:10:12 +02:00
holger krekel
9ed127b5da
fix issue203 - fixture functions with a scope=function should have a "self" that points to the actual instance with which the test functions run.
2012-10-20 09:59:20 +02:00
holger krekel
dca5fa2241
fixing links for 2.3 release, and fixing a windows32 failure on py3
2012-10-19 10:53:28 +02:00
holger krekel
586befb945
make usefixtures appear in py.test --markers output
2012-10-19 10:17:13 +02:00
holger krekel
b0b6695538
improve automatic id generation for parametrized tests
2012-10-19 10:07:13 +02:00
holger krekel
64544bee1a
fix trial tests
2012-10-18 15:09:20 +02:00
holger krekel
7c8755cc89
refine docs, fix a marker/keywords bit, and add a test that request.keywords points to node.keywords.
2012-10-18 15:06:55 +02:00
holger krekel
7d747a1cde
remove .markers attribute which was added in development and after 2.2.4
...
so never released. Rather extend keywords to also exist on nodes. Assigning
to node.keywords will make the value appear on all subchildren's
keywords.
2012-10-18 13:52:32 +02:00
holger krekel
67de2c53ac
fix issue198 - detection of fixtures from conftest.py files in deeper nested dir structures with certain invocations
2012-10-17 13:42:40 +02:00
holger krekel
26ab80c4cd
fix and test --fixtures location information
2012-10-17 13:12:33 +02:00
holger krekel
20849a44f5
improve --fixtures output with per-plugin grouping and hiding underscore names in non-verbose mode, re-introduce --funcargs for compatibiliy
2012-10-17 12:57:05 +02:00
holger krekel
98513b995a
simplify/integrate fixturemapper into FixtureManager
...
also fix jstests test failures
2012-10-17 11:20:45 +02:00
holger krekel
dc4e205876
typographic fixes, little simplification
2012-10-17 09:21:04 +02:00
holger krekel
cc2337af3a
refine parsefactories interface, fix two_classes test originally reported by Alex Okrushko, also add a few more tests to make sure autouse-fixtures are properly distinguished
2012-10-16 16:13:12 +02:00
holger krekel
37965657d0
make factorydeflist immutable by using an index
2012-10-16 13:59:12 +02:00
holger krekel
2f3bbdafda
use fixturemapper/fixtureinfo from Function objects
2012-10-16 13:48:00 +02:00
holger krekel
021c087701
implement fixture information stored on the parentnode of functions
...
to be reused by metafunc mechanics and Function setup
2012-10-16 13:47:59 +02:00
holger krekel
4541456a96
add plan for better fixture implementation, an xfailing test
...
and a slight refactoring of Metafunc tests/creation
2012-10-16 13:47:59 +02:00
holger krekel
f5d796b093
improve docs further, refine unittest docs, rename ``autoactive`` to ``autouse``
...
to better match ``@pytest.mark.usefixtures`` naming.
2012-10-12 14:52:36 +02:00
holger krekel
6eec2f5893
make tmpdir fixture always return a realpath()ed tmpdir and make a note
...
about it in the changed test. Currently, i don't see a reason why this
is a bad idea (tm)
2012-10-11 13:05:16 +02:00
holger krekel
0594265adc
fix output of --fixtures for @pytest.fixture defined functions.
2012-10-09 16:49:04 +02:00
holger@merlinux.eu
39b8a19cf7
Fix test for windows
2012-10-08 13:42:31 +02:00
holger krekel
df643f65f0
remove support for @pytest.fixture on classes, to be reserved for future use:
...
Fixture-classes could offer setup/teardown/addoption/configure methods
and provide higher level support. Preliminary allowing it to work on classes
may make introducing it harder.
2012-10-08 11:22:31 +02:00
holger krekel
d630d02c5b
remove pytest.setup usage
2012-10-08 08:34:21 +02:00
holger krekel
cda84fb566
- allow to use fixtures directly, i.e. without ()
...
- also allow scope to be determined by a dynamic function
2012-10-06 21:03:55 +02:00
holger krekel
d3893dd5d1
allow metafunc.parametrize(scope=...) calls to override the scope of a Fixture function definition. This is useful for cases where you want to dynamically
...
set scope and parametrization for a fixture instead of statically declaring
it on the fixture function.
2012-10-06 21:01:13 +02:00
holger krekel
55a8bfd174
fix issue197 - in case a function is parametrized with zero arguments,
...
skip it during setup
2012-10-06 11:34:06 +02:00
holger krekel
d8c365ef2c
implement pytest.mark.usefixtures and ini-file usefixtures setting
...
and also refine fixture docs a bit - fixtures.txt should now mostly
reflect the current state of the implementation
2012-10-05 19:20:40 +02:00
holger krekel
d1a3f5c3a6
make the default non-error pass simpler and faster, refine error reporting by presenting "fixture" tracebacks
2012-10-05 14:24:45 +02:00
holger krekel
bb07ba7807
rename a number of internal and externally visible variables to use the fixture name
...
rather than funcargs. Introduce .funcargnames compatibility attribute for backward compat.
2012-10-05 14:24:44 +02:00
holger krekel
8282efbb40
internally unify setup and fixture code, making setup a shortcut to fixture(autoactive=True)
2012-10-05 10:21:35 +02:00
holger krekel
9251e747af
rename pytest.factory usages into pytest.fixture ones
2012-10-05 10:21:35 +02:00
holger krekel
3049af618c
avoid pyc file issues by parametrizing the test instead of rewriting conftest.py files
2012-10-04 11:51:14 +02:00
holger krekel
5173647b4d
fixes to against python3.3
2012-10-01 10:14:54 +02:00
holger krekel
57a832812b
remove unneccessary internal __request__ funcarg.
2012-10-01 09:23:39 +02:00
holger krekel
b9767fd74c
remove print, pass python32
2012-09-27 13:27:22 +02:00
holger krekel
dbe66f468a
ensure proper calling of finalizers in case of parametrization on classes
2012-09-26 12:24:04 +02:00
Ronny Pfannschmidt
35cbb5791d
fixes issue 156: monkeypatch class level descriptors
2012-09-25 18:15:13 +02:00
holger krekel
a1c3d60747
add an xfail-ed test for a potential future "enabled" parameter to setup functions
2012-09-25 15:04:30 +02:00
holger krekel
cd1ead4f7b
- make request.funcargnames carry the closure of all used funcargs
...
- make metafunc.funcargnames carry the closure of used funcargs
2012-09-24 17:04:34 +02:00
holger krekel
7768972ec5
make sure setups are called ahead of the funcarg factories of the test function
2012-09-24 10:36:22 +02:00
holger krekel
754fab9b55
merge
2012-09-22 20:26:13 +02:00
Ronny Pfannschmidt
253a87b2dc
fix issue 191 - add support for runTest method of unittest.TestCase subclasses
2012-09-22 18:24:53 +02:00
holger krekel
81082ed3d3
extend --help to tell about --markers and --funcargs
2012-09-22 11:44:56 +02:00
holger krekel
465cfff6f9
don't call nose' setup methods if they are marked with pytest.setup
2012-09-22 00:23:36 +02:00
holger krekel
738f14a48a
improve the parametrization scenario example to sort by id, rather than by file-order, see also: http://stackoverflow.com/questions/12521924/pytest-running-scenarios-in-the-correct-order-in-the-class
2012-09-21 09:39:54 +02:00
holger krekel
6cb3281ddd
allow factory/setup-markers on classes, using their respective __init__ methods which can use the funcarg mechanism
2012-09-18 14:00:47 +02:00
holger krekel
a7c6688bd6
implement full @pytest.setup function unittest.TestCase interaction
2012-09-18 10:54:12 +02:00
holger krekel
631d311e89
- add request.node which maps to the collection node as specified by the scope.
...
- remove request.markers which is now available via request.node.markers
2012-09-17 20:43:37 +02:00
holger krekel
a94bb0a8bb
introduce a new "markers" attribute to nodes and the request object. It is
...
a dynamic class making holdin
2012-09-17 17:32:23 +02:00
holger krekel
646c2c6001
drops special testcontext object in favour of "old" request object, simplifying communication and code for the 2.2-2.3 transition. also modify docs and examples.
2012-09-17 16:36:10 +02:00
Ronny Pfannschmidt
bf5b226474
fix issue 188 - ensure sys.exc_info on py2 is clear before calling into a test
2012-09-15 15:20:49 +02:00
Ronny Pfannschmidt
bfaf8e50b6
fix issue 182: testdir.inprocess_run now considers passed plugins
2012-09-03 10:12:30 +02:00
Ronny Pfannschmidt
848c749d1a
adapt the junit xml escaping test to my escaping changes
2012-09-03 09:54:02 +02:00
holger krekel
41ad7dbae1
fix issue185 monkeypatching time.time does not cause pytest to fail
2012-09-01 09:58:10 +02:00
Benjamin Peterson
a6060dfb6d
use py3 compatible print syntax
2012-08-28 16:37:43 -04:00
Benjamin Peterson
7f36649763
remove usage of exception module, which is gone in py3.3
2012-08-28 16:35:06 -04:00
Ronny Pfannschmidt
e876ad9abd
fix issue 179 - propperly show the dependency chain of factories on setup failure
2012-08-22 21:43:42 +02:00
Ronny Pfannschmidt
503addbf09
correctly have the test for issue #[C179 actually fail
2012-08-22 21:20:18 +02:00
Ronny Pfannschmidt
1318df4f5b
add xfailing test for issue 179
2012-08-22 19:49:50 +02:00
Ronny Pfannschmidt
0e8cd9297a
fix issue 176: raises(AssertionError) now catches builtin AssertionError as well
2012-08-19 13:45:26 +02:00
Ronny Pfannschmidt
0cca20bef9
ignore magic callables with no sane code in factory/setup discovery
2012-08-19 12:36:49 +02:00
Ronny Pfannschmidt
1446b4b4e6
fix issue #178 and extend the failure escape test
2012-08-17 16:08:08 +02:00
holger krekel
627e068516
fix issue172 so that @pytest.setup marked setup_module/function... functions
...
are not called twice. Also fix ordering to that broader scoped setup
functions are executed first.
2012-08-13 13:37:14 +02:00
holger krekel
935761f098
also improve missing funcarg error for setup functions
2012-08-08 14:53:47 +02:00
holger krekel
dd268c1b2b
improve error representation for missing factory definitions
...
in recursive funcarg reconstruction
2012-08-08 11:48:53 +02:00
holger krekel
172505f703
fix/consolidate --junitxml=path construction with relative pathes
2012-08-04 10:33:43 +02:00
holger krekel
46dc7eeacb
move pytest.mark.factory/setup to pytest.factory/setup, as per flub 's suggestion
2012-08-02 12:41:46 +02:00
holger krekel
535d892f27
- rename @funcarg to @factory
...
- introduce a "testcontext" object for new-style funcargs and setup methods
- New-style funcargs and setup methods cannot use the "request" object anymore.
2012-08-01 13:57:09 +02:00
holger krekel
cb2eb9ba33
reorder internal layout so that funcarg-related functionality is in python.py
2012-08-01 09:23:39 +02:00
holger krekel
4f94ab4e42
mark a test as xfailing on python2.5
2012-08-01 09:10:40 +02:00
holger krekel
449b55cc70
- enhance ordering of tests using parametrized resources
...
- introduce a refined way to perform finalization for setup functions
which does not use cached_setup() anymore
2012-08-01 09:07:32 +02:00
holger krekel
9dc79fd187
introduce a funcargcall object, holding meta information
2012-07-30 12:39:45 +02:00
holger krekel
b57fb9fd47
introduce a SetupCall, holding meta information and setup calling state
2012-07-30 11:51:50 +02:00
holger krekel
d68c65b493
minimize active parametrized non-function scoped resources by
...
- re-ordering at collection time
- modifying setup/teardown
2012-07-30 10:46:03 +02:00
holger krekel
fa61927c6b
introduce @pytest.mark.setup decorated function,
...
extend newexamples.txt and draft a V4 resources API doc.
2012-07-24 12:10:04 +02:00
holger krekel
d4a487c725
allow funcarg factories to receive funcargs
2012-07-23 10:55:09 +02:00
holger krekel
6b0f0adf5b
implement a scope/parametrized examples using the so-far new features
...
also fix a bug with scoping/parametrization
2012-07-20 14:16:50 +02:00
holger krekel
396045e53f
allow registration of "funcarg" marked factories
2012-07-20 14:16:49 +02:00
holger krekel
80db25822c
implement funcarg factory scope marker and ScopeMismatch detection
2012-07-20 14:16:46 +02:00
holger krekel
f358fe7154
extend Metafunc and write a pytest_generate_tests hook on the funcarg manager
...
which discovers factories
2012-07-20 14:16:46 +02:00
holger krekel
e14459d45c
discover funcarg factories independently from request/Function items
2012-07-20 14:16:28 +02:00
holger krekel
4e4b507472
move funcarg factory to a new FuncargManager object at session level
2012-07-19 09:20:14 +02:00
holger krekel
c7ee6e71ab
re-introduce the old 2.2.4 FuncargRequest implementation as it is a better
...
base for implementing the new funcarg/setup api. Also Un-optimize
funcargnames discovery for now.
2012-07-18 19:49:14 +02:00
holger krekel
8adac2878f
put automatic funcarg_ API to Py*objects only, refine internal subclassing and initialisation logic
2012-07-16 10:46:44 +02:00
Benjamin Peterson
099ac1e1f4
cleanup test a bit
2012-07-07 08:01:44 -07:00
Floris Bruynooghe
1aca6c9d7c
Fix extension of of cached re-written file
...
With PYTHONOPTIMIZE set this had the extension of "o" instead of ".pyo".
Fixes issue #168 .
2012-07-07 16:09:53 +02:00
Ronny Pfannschmidt
74e55493d1
test and implement showing verbose assert repr for py.test -vv
2012-06-27 17:26:55 +02:00
holger krekel
ecec653e98
fix issue151 - heuristcally lookup conftest files on all command line arguments, not just the first existing dir/file
...
you can install the corresponding pytest-2.3.dev2 via
pip install -i http:/pypi.testrun.org -U pytest
2012-06-26 21:56:03 +02:00
holger krekel
b4b86159cd
better name for the oejskit-compatibility-class.
2012-06-25 17:49:13 +02:00
holger krekel
91b6f2bda8
mid-scale refactoring to make request API available directly on items.
...
This commit was slightly tricky because i want to backward
compatibility especially for the oejskit plugin which
uses Funcarg-filling for non-Function objects.
2012-06-25 17:35:33 +02:00
holger krekel
227d847216
fix problem with unicode in writing failure representations to terminal, thanks ThomasWaldmann
2012-06-24 16:42:31 +02:00
holger krekel
6e0c30d67d
fix skip/xfail confusion, reported and discussed on
...
http://stackoverflow.com/questions/11105828/in-py-test-when-i-explicitly-skip-a-test-that-is-marked-as-xfail-how-can-i-get
2012-06-23 11:32:32 +02:00
holger krekel
e79a312b92
fix internal test setup failure
2012-06-21 11:30:10 +02:00
holger krekel
ccc04b9fc4
some refinements to reporting and hook order
2012-06-21 11:07:22 +02:00
holger krekel
18306a4644
add header info: always report 3rd party plugins in test runs
2012-06-20 00:16:47 +02:00
holger krekel
1bbe1d086c
fix issue160 a failing setup of an xfail-marked tests should
...
be reported as xfail (not xpass)
2012-06-19 23:48:39 +02:00
holger krekel
b2e87ce027
change pluginmanager.register API to raise ValueError if the plugin object or the name is already registered
2012-06-16 21:29:04 +02:00
holger krekel
3f17784386
fix issue128 - show captured output when capsys/capfd are in use
2012-06-03 21:01:27 +02:00
holger krekel
0790f7a75f
fix issue 144 - wrong classname in junitxml
2012-05-22 17:18:04 +02:00
Ronny Pfannschmidt
db8fbe7661
skip test for pyo on pypy since pypy doesnt do pyo
2012-05-22 16:20:58 +02:00
holger krekel
51d94a4a6e
use higher difference on timing
2012-05-18 13:56:49 +02:00
holger krekel
e18abfd013
fix issue143 - call unconfigure/sessionfinish always when
...
configure/sessionstart where called
use exitcode 4 (instead of 3 which signaled an internal error)
when an initial directory/file was not found
2012-05-17 23:11:23 +02:00
Ronny Pfannschmidt
0e3779b14f
strip bound wrappers of class setup/tardown, fixes #140
...
on python3 im_func is replaced by __func__
2012-05-06 23:03:16 +02:00
Benjamin Peterson
b4588f1798
escape the % operator in string formatting
2012-05-03 13:49:30 -04:00
Benjamin Peterson
1c817aa7bd
don't use octal syntax, since its not py2/py3 compatible
2012-04-18 11:26:44 -04:00
Ronny Pfannschmidt
d02eaa8881
fix a import strange loop that affects pypy test appsupport on python2.5
2012-04-13 12:41:02 +02:00
holger krekel
58933aac2a
try to better handle @unittest.expectedFailure decorator
2012-03-19 22:53:52 -07:00
Ronny Pfannschmidt
ee8d2f9950
junitxml: use a exclusive match on the legal ranges of xml for binary escaping, fixes issue 126
2012-03-09 13:12:18 +01:00
Ronny Pfannschmidt
2ca6d9f039
no longer check if indirect metafunc.parametrize params are funcarg names
2012-02-03 16:54:00 +01:00
Ronny Pfannschmidt
78e7d7aed0
more quit collectonly shows only files and the number of tests in them
2012-02-03 16:56:06 +01:00
Ronny Pfannschmidt
68b353be0d
create session.items before preparse, so collectonly wont break on preparse fail, fixes #115
2012-02-03 16:33:32 +01:00
holger krekel
dfa273dc25
fix issue177 - actually perform session scope finalization
2012-02-01 08:52:34 -05:00
Ronny Pfannschmidt
5263656df6
kwarg support for reports, so xdist can deserialized extended reports
2012-01-20 19:50:45 +01:00
Ralf Schmitt
93424b0f9c
add monkeypatch.chdir method
2012-01-04 12:43:19 +01:00
Ralf Schmitt
4131923c0f
test that a second undo doesn't change sys.path
...
also use a 'mp' funcarg that restores sys.path and the current working
directory in preparation for the monkeypatch.chdir method.
2012-01-04 12:40:57 +01:00
holger krekel
fa6d5bd15b
work around an apparent python2.4/python2.5 bug with subprocess.Popen,
...
causing jenkins failures. Apparently "os.environ.popitem(name, None)"
is not the same as::
try:
del os.environ[name]
except KeyError:
pass
2011-12-28 15:49:13 +00:00
holger krekel
f2c8a837af
fix issue106: allow parametrize to be applied per-class/per-module
2011-12-28 15:47:19 +00:00
holger krekel
ccc1b21ebd
internally keep multiple applications of the same markers as separate
...
entities such that the new iter() API can iterate over pytest.mark
function attributes, getting all such applications. See added example
for more info.
2011-12-28 15:47:18 +00:00
holger krekel
85f2a78005
fix wrongly committed line
2011-12-28 07:57:19 +00:00
holger krekel
e21202b730
fix Jenkins test failures
2011-12-27 21:03:15 +00:00
Benjamin Peterson
8e83af1c33
fix spacing
2011-12-19 14:23:39 -05:00
Benjamin Peterson
268c051eba
propogate current PYTHONPATH
2011-12-19 12:02:07 -05:00
Benjamin Peterson
03cb37b1eb
use an exception more consistent across python versions
2011-12-19 11:56:22 -05:00
holger krekel
d5c3265763
fix issue101: wrong args to unittest.TestCase test function now
...
produce better output
2011-12-18 23:01:39 +00:00
holger krekel
5093d8b925
fix test to actually mean something useful (thanks Jurko)
2011-12-18 10:56:39 +00:00
holger krekel
40187ec9bb
robustify monkeypatch
2011-12-16 22:41:23 +00:00
holger krekel
82ba764bb6
fix unorderable types as reported by Ralf Schmitt
2011-12-14 10:56:51 +00:00
holger krekel
a94a6b4282
fix issue99 - internalerror with --resultlog now produce better output.
...
the fix depends on another change in the py lib which unifies
the output for native and non-native traceback formatting styles
2011-12-10 08:49:21 +00:00
holger krekel
8307270cec
yay! now that we have perfect teardowns we don't need some ugly internal hooks anymore.
2011-12-02 21:00:21 +00:00
holger krekel
c4fe622b82
fix issue93 - avoid "delayed" teardowns for distributed testing by
...
simplifying handling of teardowns.
2011-12-02 21:00:19 +00:00
Ronny Pfannschmidt
b28977fbaf
take the skip property of unittest cases and functions into account
2011-12-01 20:17:24 +01:00
holger krekel
a5e7b2760d
fix issue90 - perform teardown after its actual test function/item. This is implemented by modifying the runtestprotocol to remember "pending" teardowns and call them before the setup of the next item.
2011-11-18 16:01:29 +00:00
holger krekel
ec0565fac5
introduce metafunc.parametrize() and @pytest.mark.parametrize with examples. deprecate metafunc.addcall()
2011-11-17 11:09:21 +00:00
holger krekel
8f55425898
fix issue87 - pastebin option now works with python3
2011-11-15 13:35:06 +00:00
holger krekel
a51e52aee3
fix issue89 apply Daniel Nouri's patch to doctest/--pdb interaction.
2011-11-15 13:28:22 +00:00
Ronny Pfannschmidt
69dfc75572
test and fix pastebin xmlrpc import name missmatch, fixes #87
2011-11-14 17:51:12 +01:00
holger krekel
f7c1b9087a
fix test
2011-11-11 23:18:33 +00:00
holger krekel
36c42b5c15
introduce a new -m mark_expression option
2011-11-11 23:02:06 +00:00
holger krekel
bc8ee95e72
add ini-file "markers" option and a cmdline option "--markers" to show defined markers. Add "skipif", "xfail" etc. to the set of builtin markers shown with the --markers option.
2011-11-11 22:56:11 +00:00
holger krekel
979dfd20f2
add a method to the config object to dynamically add a value to an (line-type) ini-value
2011-11-11 22:56:08 +00:00
holger krekel
bd296c796f
try to avoid timing/race condition
2011-11-08 23:04:31 +00:00
holger krekel
7144cec580
avoid race condition in test, fix doc link
2011-11-08 22:06:57 +00:00
holger krekel
99a1188287
simplify durations output, no percentage, no "remaining" bits
2011-11-08 20:57:19 +00:00
holger krekel
0b18b6094e
fix duration option in case of collection errors
2011-11-08 19:00:25 +00:00
holger krekel
a324826dfd
separate out the duration tests
2011-11-08 18:12:16 +00:00
holger krekel
29bf205f3a
make --durations also show the execution times of setup/teardown calls. This requires a slight incompatibility - pytest_runtest_logreport now sees setup/teardown reports even if the tests passed.
2011-11-08 17:53:46 +00:00
holger krekel
3b9fd3abd8
introduce --durations=N showing slowest test executions
2011-11-08 17:20:56 +00:00
holger krekel
974e4e3a9d
skip the symlink test on windows, win32/py32 does not support it without privs
2011-11-07 22:00:12 +00:00
holger krekel
369b7709f7
use os.symlink to make things work on windows/py32
2011-11-07 21:02:07 +00:00
holger krekel
a2f4a11301
refine lsof/FD leakage testing and rework test setup and some of pytest own tests. Note that the actual diff to non-test code is small. Also remove some redundant tests (introduced by a copy-paste-error apparently in test_mark.py).
2011-11-07 18:08:41 +00:00
holger krekel
077c468589
don't remove symlinks from temporary directory path - should help with some standard OSX setups
2011-11-06 19:34:02 +00:00
holger krekel
d4fe273b2f
fix FD leakage during pytest's own test run and add "--lsof" option to tox default test runs.
...
the leakage came down to a problematic bit of the stdlib logging module: it takes ownerships of stdout/stderr making it hard for pytest to implement clean capturing. The current work around is to add some extra code in the setup machinery of pytest's own tests which actually closes sub-FDs.
2011-11-06 15:40:17 +00:00
Ronny Pfannschmidt
5ae04397bd
proper tests for issue74, thanks Arfrever
2011-10-26 23:59:22 +02:00
Ronny Pfannschmidt
2c230f910d
fix issue74 - propperly filter out missfit names in _tryconvertpyarg
2011-10-26 22:40:08 +02:00
Floris Bruynooghe
e2201fe3a9
Look up the pytest_assertrepr_compare hook for each test item
...
Before this was only done at the time the assertion plugin was loaded.
This lead to counter-intuitive behaviour where two subdirectories with
a pytest_assertrepr_compare hook in their conftest.py would not work,
only one would ever be used.
This defers assiging the _pytest.assertion.util._reprcompare function
until the item is loaded (pytest_runtest_setup) so that it can use the
hookrelay of the test item to find the appropriate
pytest_assertrepr_compare hook for the item.
This fixes issue #77 .
2011-10-16 11:51:15 +01:00
Benjamin Peterson
29b4082b00
put the explanation generating code in the conditional fail body ( fixes #79 )
2011-10-14 16:26:13 -04:00
Ronny Pfannschmidt
6ac638ba87
add a reportchar for reporting errors, fixes #76
2011-09-29 23:44:26 +02:00
Ronny Pfannschmidt
f2512017ea
correctly handle zero length cmdline arguments
2011-09-25 23:26:49 +02:00
holger krekel
3bd3ba133f
fix issue75 - test failure on jython.
...
also experimentally enable more tests in the jython test env.
2011-09-25 07:40:43 +02:00
holger krekel
d37af98db3
try to make test suite pass on jython 2.5.1 again
2011-09-21 08:12:37 +02:00
holger krekel
eaec527a60
relax error string matching
2011-09-21 06:21:48 +02:00
Benjamin Peterson
2bc4065a00
rewrite file newlines when the python parser is picky
2011-09-20 17:53:07 -04:00
holger krekel
5c32421f2e
merge, bump version
2011-09-12 08:57:35 +02:00
Florian Mayer
2315de8321
Add FIXME.
2011-09-05 22:01:50 +02:00
Florian Mayer
25711a0879
Add acceptance test for new --pyargs behavior.
2011-09-05 17:38:22 +02:00
Benjamin Peterson
8675cf640d
every boolop operand must have it's own format context ( fixes #69 )
2011-08-30 10:34:21 -04:00
Benjamin Peterson
661a8a4a92
only use the last part of the module name in the filename ( fixes #68 )
2011-08-30 00:12:07 -04:00
Benjamin Peterson
abe080c6b4
use different caches for optimized and unoptimized code ( fixes #66 )
2011-08-29 10:13:00 -04:00
holger krekel
fb1b1d9aae
jython-2.5.2 has a core bug preventing pytest to run :(
2011-08-19 19:25:52 +02:00
holger krekel
c426a67b0e
make test skipping more precise to fix a py32 test failure
2011-08-18 22:52:02 +02:00
Ronny Pfannschmidt
7636dc76e0
support pytest.set_trace in collection
2011-08-01 10:53:37 +02:00
Benjamin Peterson
643ab120f4
only try to create the __pycache__ dir (not a tree to it) fixes #60
...
Also, improve error handling surrounding __pycache__ creation.
2011-07-25 21:40:38 -05:00
Benjamin Peterson
f86c8469f5
now fix py3...
2011-07-19 22:56:34 -05:00
Benjamin Peterson
22335acd09
use binary mode
2011-07-19 22:45:27 -05:00
Benjamin Peterson
8b866aa065
add a newline for window's sake
2011-07-19 22:41:58 -05:00
Benjamin Peterson
2c4964d290
escape '%' in specialized comparison explanations ( fixes #63 )
2011-07-19 21:42:00 -05:00
holger krekel
650c3bcfde
enhance debug tracing: print trace tags at the end of message and forget about "prefix".
...
Always log to "pytestdebug.log" if "--debug" option is given.
also move related code to pytest_helpconfig plugin.
2011-07-14 19:11:50 +02:00
Benjamin Peterson
ade9b9aa8e
add a test for vararg call
2011-07-14 11:46:32 -05:00
Benjamin Peterson
7576b3c7d0
fix assertion rewriting on calls with a double-star arg
2011-07-14 11:45:42 -05:00
Benjamin Peterson
85415135a4
merge heads
2011-07-13 13:34:24 -05:00
Benjamin Peterson
3cc8697744
respect sys.dont_write_bytecode and PYTHONDONTWRITEBYTECODE
2011-07-13 13:33:54 -05:00
holger krekel
703da22831
put systemout/systemerr to correct xml location
2011-07-13 18:47:27 +02:00
Benjamin Peterson
14ceaf2459
fix assertion rewriting in read-only directories (refs #60 )
2011-07-12 17:09:14 -05:00
holger krekel
f3bc197afb
fix #59 : provide better Jenkins stdout and stderr sections
2011-07-12 23:09:03 +02:00
Benjamin Peterson
a59c2c9e17
roll test_long_chain in with other boolop tests
2011-07-11 09:24:07 -05:00
Michał Bartoszkiewicz
6096aeca53
Fix a typo in assertion rewriting.
2011-07-11 11:57:47 +02:00
holger krekel
d1684e8052
report keyboardintterupt even if inteerrupted during sessionstartup
2011-07-07 21:24:09 +02:00
Benjamin Peterson
6a523b4f59
make test name shorter, so its testdir path isn't too long on windows
2011-07-07 09:43:39 -05:00
Benjamin Peterson
c13fa886d9
simplify rewrite-on-import
...
Use load_module on the import hook to load the rewritten module. This allows the
removal of the complicated code related to copying pyc files in and out of the
cache location. It also plays more nicely with parallel py.test processes like
the ones found in xdist.
2011-07-06 23:24:04 -05:00
holger krekel
758b5e3511
fix issue53: nose-style setup now called with the correct ordering
2011-07-05 21:23:59 +02:00
holger krekel
46950ef19a
rename and simplify the assert option:
...
cmdline usage is now: --assert=rewrite/reinterp/plain
there is no conflict detection (don't think that's neccessary)
2011-07-05 17:29:53 +02:00
holger krekel
407ca5b120
fix python2.5 compatibility
2011-07-05 15:21:08 +02:00
Benjamin Peterson
a4fe63c08d
test files are rewritten in a subprocess
2011-07-03 19:28:48 -05:00
Benjamin Peterson
ae8ee08ac0
adjust for new option
2011-06-29 13:28:04 -05:00
Benjamin Peterson
aa7f7a1c71
rename --assertmode choices to be more explicit
2011-06-29 09:44:04 -05:00
Benjamin Peterson
48b76c7544
rewrite test modules on import
2011-06-28 21:13:12 -05:00
Benjamin Peterson
f286a02582
rewrite with proper short-circuting on boolean operators ( fixes #57 )
2011-06-28 20:21:22 -05:00
Benjamin Peterson
c6e3606c6b
fix the rewriter on relative imports ( fixes #58 )
2011-06-28 10:39:11 -05:00
Benjamin Peterson
8e81ed693a
put explanation simplification in format_explanation so everyone can benefit
2011-06-12 22:41:58 -05:00
Benjamin Peterson
2618e3640f
account for quotes in error messages
2011-06-03 22:11:00 -05:00
holger krekel
ce1b456762
back out pytest_configure_funcargs hook for now
2011-06-01 15:08:54 +02:00
holger krekel
e3b2792677
fix issue49 - avoid confusing errors when initialization goes wrong
2011-06-01 14:54:34 +02:00
holger krekel
67859158d4
fix issue48 - test and fix typo in MarkInfo repr
2011-06-01 08:03:06 +02:00
holger krekel
5690beab5a
merge Benjamin's assertion-rewrite branch: all assertion related code is now part of py.test core distribution - the builtin assertion plugin to be precise.
...
See doc/assert.txt for details on how what has been improved.
2011-05-31 14:11:53 +02:00
holger krekel
8bc9fdc8d3
fix a buffering issue that i think/hope only occurs during internal tests
2011-05-29 09:21:48 +02:00
holger krekel
5e311d3bfc
fix timing float comparison
2011-05-29 00:45:31 +02:00
Ronny Pfannschmidt
5498fe960f
add another normpath in the junitxml tests
2011-05-28 19:00:23 +02:00
Ronny Pfannschmidt
4c885cf0d2
hopefully final win32 fix for the junitxml path expansion
2011-05-28 17:36:38 +02:00
Ronny Pfannschmidt
70dc7a976d
dont wrap comparisation paths in py.path.local for the junitxml tests, since missing $HOME causes issues else
2011-05-28 16:52:05 +02:00
holger krekel
410438f187
fix issue43 - better tracebacks for unexpected exceptions in doctests
2011-05-28 14:38:15 +02:00
holger krekel
8dc4e732f0
fix issue47 - fix time-per-test timing output for junitxml
2011-05-28 14:03:10 +02:00
Ronny Pfannschmidt
56b40ebd75
use os.path.expanduser/expandvars on the junitxml path for convience, fixes #44
2011-05-27 07:54:03 +02:00
Benjamin Peterson
971f34147a
test that tests get rewritten
2011-05-26 20:06:11 -05:00
Benjamin Peterson
7cf8afef47
cause configure hooks to be called
2011-05-26 18:10:49 -05:00
Benjamin Peterson
dd199d255c
move _setupstate into session
2011-05-26 17:08:56 -05:00
Benjamin Peterson
c4d761fe99
these tests should cause pytest_configure to be called
2011-05-26 16:50:04 -05:00
Benjamin Peterson
d438a0bd83
introduce --assertmode option
2011-05-26 14:34:27 -05:00
Benjamin Peterson
250160b4b0
refactor explanation formatting things into their own module
2011-05-26 12:01:34 -05:00
Benjamin Peterson
f423ce9c01
import assertion code from pylib
2011-05-25 17:54:02 -05:00
Benjamin Peterson
491c05cea7
create the _pytest/assertion package
2011-05-25 16:18:45 -05:00
Benjamin Peterson
c0910abf2f
account py3 range objects
2011-05-24 18:30:18 -05:00
Benjamin Peterson
fa412675fc
use py.builtin.exec_
2011-05-24 18:28:05 -05:00
Benjamin Peterson
0bb84abca7
handle comparison results which raise when asked for their truth value
2011-05-24 18:15:08 -05:00
Benjamin Peterson
f5decc90ca
test that python loads our fake pycs
2011-05-24 17:52:17 -05:00
Benjamin Peterson
76cede83c0
add a way to disable assertion rewriting for a module
2011-05-24 17:30:35 -05:00
Benjamin Peterson
9c4f6791e5
give initial imports a reasonable lineno
2011-05-24 17:21:58 -05:00
Benjamin Peterson
7ba8fee3dc
improve this test
2011-05-20 09:44:36 -05:00
Benjamin Peterson
aae89cd021
correctly handle multiple asserts
2011-05-19 18:56:48 -05:00
Benjamin Peterson
9e6dfaefd9
place assertion imports after __future__ statements and docstrings
2011-05-19 16:53:13 -05:00
Benjamin Peterson
c742e47de0
new assertion debugger which rewrites asserts before they are run
2011-05-18 15:31:10 -05:00
Ronny Pfannschmidt
b6815538c5
introduce the pytest_configure_funcargs hook for better control on funcarg instanciation/configuration
2011-05-12 23:47:05 +02:00
holger krekel
942ae47cd1
tentatively use internal list for cleanups at unconfigure time - this helps reporting with partially executed pytest_configure() hooks
2011-04-17 12:20:13 +02:00
holger krekel
06ca7090f9
fix issue38 - nicer tracebacks on sessionstart/configure (and other internal/custom hook failures)
2011-04-17 12:20:11 +02:00
Floris Bruynooghe
1c1918eb22
Prevent null-characters from appearing in junitxml's output
...
The Jenkins XML parser does not deal with null-characters inside the
XML. This replaces any null character with nothing in the XML output,
which makes no visual difference.
2011-04-16 00:09:25 +01:00
Floris Bruynooghe
60ff2e8529
Allow unicode characters in testdir.makepyfile()
...
On python2.x text arguments where passed through str, which meant only
ascii-encodable strings could be used. This uses
py.builting._totext() to keep unicode until it is written out to the
file, which was already UTF-8 encoded.
2011-04-11 23:15:56 +01:00
holger krekel
3a9788fc6f
fix missing reason/name information for skipped tests
2011-03-19 17:59:07 +01:00
holger krekel
ed6d2537bc
fix issue33 - no collection error for classes prefixed "test" deriving from object
2011-03-16 16:36:18 +01:00
holger krekel
1a7c6ecc42
fix slightly wrong verbose output for non subclasses on windows
2011-03-08 13:37:00 +01:00
holger krekel
f2670651b3
half the overhead for calling a test function by introducing some caching
2011-03-07 18:28:45 +01:00
holger krekel
c552b58dc5
fix issue27 - --collectonly and -k keyword selection now work together.
...
internally, collectonly and terminal reporting has been unified.
2011-03-06 18:32:00 +01:00
holger krekel
18e784c9c9
re-introduce pytest._fillfuncargs - it's actually used by oejskit,
...
added a test documenting this.
2011-03-06 08:56:58 +01:00
Ronny Pfannschmidt
a6c518e68c
unittest plugin: prune __unittest marked modules from traces
2011-03-05 17:49:51 +01:00
holger krekel
7e44c38570
avoid this test on pypy because syntax errors on pypy-1.4.1 are not precise it seems
2011-03-05 14:59:06 +01:00
holger krekel
bfe6e98abb
don't expose _fillfuncargs (no clue why it ever was exposed)
2011-03-05 14:29:10 +01:00
holger krekel
07cee24122
avoid deprecation warnings for our internal accesses
2011-03-05 14:16:27 +01:00