Commit Graph

59 Commits

Author SHA1 Message Date
Bruno Oliveira a912d3745b Moved py.code code over to py.test
Fix #103
2016-01-25 23:18:04 -02:00
Florian Bruhin 19791546da Add docstring. 2015-08-31 15:11:57 +02:00
Florian Bruhin 885e461ae3 Fix overriding of fixtures with parametrization.
Fixes #979, see #926.
2015-08-31 14:38:39 +02:00
Markus Unterwaditzer 41cef6f5f2 Don't skip fixtures that are substrings of params
Bug introduced with
https://bitbucket.org/pytest-dev/pytest/pull-requests/257/allow-to-override-parametrized-fixtures

Fix #736
2015-08-11 00:41:21 +02:00
Bruno Oliveira df29120abe Merge branch 'pytest-2.7'
Conflicts:
	_pytest/config.py
	_pytest/genscript.py
	_pytest/mark.py
	tox.ini
2015-07-23 22:35:51 -03:00
Anatoly Bubenkov 6af7172204 Merge branch 'pytest-2.7' 2015-07-19 15:25:04 +02:00
Bruno Oliveira 2f7d0f8bd9 Consider --color option in more places which deal with TerminalWriters 2015-07-18 16:39:55 -03:00
Bruno Oliveira 0f52856f99 Use a subdirectory in the TEMP directory to speed up tmpdir creation
Fix #105
2015-07-15 20:03:58 -03:00
Bruno Oliveira 5ec2a17f08 --fixtures only shows fixtures from first file
Fix #833
2015-07-12 17:32:39 -03:00
holger krekel 9aec5cd52d use runpytest() instead of runpytest_inprocess if a test can run as subprocess as well
--HG--
branch : testrefactor
2015-04-28 12:05:08 +02:00
holger krekel db5649ec6a streamline pytester API majorly:
- integrate conftest into pytester plugin
- introduce runpytest() to either call runpytest_inline (default) or
  runpytest_subprocess (python -m pytest)
- move testdir.inline_runsource1 to pdb tests
- strike some unneccessary methods.
- a new section "writing plugins" and some better pytester docs

--HG--
branch : testrefactor
2015-04-28 11:54:53 +02:00
holger krekel a8afba054a - refine lsof checking
- make runpytest() create an inline testing process instead of
  a subprocess one

--HG--
branch : testrefactor
2015-04-28 11:54:46 +02:00
holger krekel d3e363b97a - make API between runpytest() and inline_run() more similar
- shift a number of tests to become inline_run() tests

--HG--
branch : testrefactor
2015-04-28 11:54:45 +02:00
holger krekel d632a0d5c2 merge conftest management into PytestPluginManager
--HG--
branch : plugin_no_pytest
2015-04-22 14:15:42 +02:00
holger krekel 3ed3e51997 fix issue660: properly report fixture scope mismatches independent
from fixture argument ordering.

--HG--
branch : issue660
2015-04-01 18:42:48 +02:00
holger krekel d2a8866bce bump verrsion to python2.7, fix a too precise test for windows, regen docs 2015-03-26 09:34:10 +01:00
Bruno Oliveira eead0365b5 Merged in parametrized-fixture-override (pull request #257)
allow to override parametrized fixtures with non-parametrized ones and vice versa
2015-03-12 09:40:56 -03:00
Daniel Hahler 5d6b0a59c0 Strip docstrings in output with `--fixtures`
Fixes https://bitbucket.org/pytest-dev/pytest/issue/550.

--HG--
branch : strip-docstrings-from-fixtures
2015-03-04 17:00:24 +01:00
Anatoly Bubenkov 060609317a allow to override parametrized fixtures with non-parametrized ones and vice versa
--HG--
branch : parametrized-fixture-override
2015-03-01 13:54:43 +01:00
Ronny Pfannschmidt 5941b2e071 fix issue 655: crude workarounds around python2/3 exception leaks 2015-01-09 19:55:49 +01: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 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
Floris Bruynooghe 2d7a32f7ea Add test case for using different modules 2014-07-18 01:30:29 +01:00
Floris Bruynooghe 115f15600f Add test for inter-dependent fixtures
Together with cc0a46a13ac4 this fixes issue 467.
2014-06-15 19:57:52 +01:00
Floris Bruynooghe c46e2cbbc7 Cache exception raised in fixtures according to their scope
Without this if a session scoped fixture fails it's setup it will
be re-tried each time it is requested.  Especially in case of
skip or failure exceptions this can be undesirable, but caching
makes sense for all exceptions.
2014-04-15 22:22:41 -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 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 86284689a3 simplify loop which turns direct funcarg parametrization to indirect 2014-01-27 12:53:44 +01:00
Floris Bruynooghe 0c737e3de0 Allow parameterised fixtures to give paramemter IDs
This is just like the markers etc already can do.
2013-12-15 22:15:15 +00:00
holger krekel 7766526992 address issue122 -- explode "params" into a list in fixture function decorators 2013-12-09 10:48:15 +01:00
holger krekel 10edfa65dc fix issue396 -- properly sort tests using class-scoped parametrization
also refix issue323 in a better way to avoid recursion for the fixture-grouping
algorithm alltogether.
2013-12-07 20:55:17 +01:00
holger krekel 4f0879ff9b refactor internal finalization mechanics such that all fixture arguments
in a test invocation will have a corresponding FixtureDef instance.
also fixes issue246 (again).

simplify parametrized fixture teardown by making it work lazy:
during the setup of a parametrized fixture instance any previously
setup instance which was setup with a different param is torn down
before setting up the new one.
2013-12-07 16:37:46 +01:00
holger krekel cb485e5af4 reopen #246 -- it turns out parametrized finalization ordering is not fully fixed -- i modified the test and marked it xfail for now. 2013-12-04 16:09:37 +01:00
holger krekel e31f40c2d0 fix ordering of finalizers of parametrized interdependent fixtures.
This fixes issue246 as reported.  Thanks Ralph Schmitt for the
precise failure example.
2013-11-21 14:16:44 +01:00
holger krekel bb5f1e8173 refactor internal FixtureRequest handling to avoid monkeypatching.
One of the positive user-facing effects is that the "request" object
can now be used in closures.
2013-11-21 12:21:52 +01:00
holger krekel 05fbd490da addresses issue246: add a test for module/function scope that shows that
finalizer ordering is wrong.
2013-11-21 09:42:24 +01:00
holger krekel 5322f057a0 move two fixture test modules into bigger testing/python/fixture.py 2013-11-21 09:26:45 +01:00
holger krekel 8ac5af2896 fix flakes issues and make --flakes run part of tox runs 2013-10-12 15:39:22 +02:00
holger krekel de35b077a2 disallow yield in non-yield-fixtures for now. This is an incompataibility but we want to prepare for possibly merging fixture and yield_fixture some day. 2013-09-30 13:56:54 +02:00
holger krekel 086d4e4ced strike keyword argument in favour of new pytest.yield_fixture decorator 2013-09-30 13:42:39 +02:00
holger krekel da7133d201 fix some tests wrt to expecting output now that pytest does no
introduce unwanted "buffering" on "-s" calls.
2013-09-27 12:28:34 +02:00
holger krekel 3ab9b48782 introduce yieldctx=True in the @pytest.fixture decorator. Refactor tests and docs. 2013-09-26 12:57:21 +02:00
holger krekel 7d86827b5e ref #322 cleanup all teardown calling to only happen when setup succeeded.
don't use autouse fixtures for now because it would cause a proliferation
and overhead for the execution of every test.  Rather introduce a
node.addfinalizer(fin) to attach a finalizer to the respective node
and call it from node.setup() functions if the setup phase succeeded
(i.e. there is no setup function or it finished successfully)
2013-08-02 09:52:40 +02:00
Mathieu Agopian 7fc0d45a4c refs #322: setUpClass and tearDownClass as autouse fixture and finalizer 2013-08-01 23:48:40 +02:00
Floris Bruynooghe 2cdb54225c Fix issue 336: autouse fixtures in plugins work again
When an autouse fixture in a plugin was encountered None was stored as nodeid
where it used to be ''.  This broke the lookup of autouse fixtures later on.

This also adds another test for the normal fixture ordering which was slightly
wrong: a fixture without location was always added at the front of the fixture
list rather then at the end of the fixtures without location but before the
fixtures with location.
2013-08-01 18:58:28 +01:00
holger krekel 8f24e10571 add changelog entry for anthon's hynek-fication of options,
and change the docs and tests to use the new style.
2013-08-01 17:32:19 +02:00
holger krekel 1280add047 SO-17664702: call fixture finalizers even if the fixture function
partially failed (finalizers would not always be called before)
2013-07-17 10:29:11 +02:00
Anatoly Bubenkov 589138ea71 re #320 fallback to test scope if the class-scoped fixture is used in non-class-based test function
--HG--
branch : 320-class-scoped-fixture-caching-is-broken-if
2013-07-06 21:30:24 +02:00
Floris Bruynooghe e6a063ee47 Solve fixture ordering when loading plugins from conftest
Conftests are plugins with a location attached to them while other
plugins do not have a location.  When ordering fixturedefs those from
plugins without a location need to be listed first.
2013-07-06 17:56:54 +02:00
Anatoly Bubenkov 2c7613c15c merge with upstream 2013-07-06 10:06:12 +02:00