Bruno Oliveira
854e603f84
Add new testdirs ini option
...
Fix #694
2015-07-10 21:52:47 -03:00
Florian Bruhin
8664fc4102
Add a --noconftest option.
2015-06-23 09:38:54 +02:00
holger krekel
bddc88f09e
adapt to pluggy naming, rename pytest.hookspec_opts to pytest.hookspec,s ame with hookimpl_opts
...
--HG--
branch : pluggy1
2015-05-06 10:08:08 +02:00
holger krekel
25963e0544
adapt pytest to pluggy's decoratorclass branch
...
--HG--
branch : pluggy1
2015-04-29 16:40:52 +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
32165d82b1
introduce a new subset_hook_caller instead of remove make_hook_caller
...
and adapat and refine conftest/global plugin management accordingly
--HG--
branch : more_plugin
2015-04-26 00:10:52 +02:00
holger krekel
d422247433
specialize make_hook_caller to work with a subset of the registered plugins.
...
--HG--
branch : more_plugin
2015-04-25 22:13:42 +02:00
holger krekel
d2a5c7f99b
add documented hookimpl_opts and hookspec_opts decorators
...
so that one doesn't have to use pytest.mark or function-attribute setting anymore
--HG--
branch : more_plugin
2015-04-25 11:29:11 +02:00
holger krekel
715a235b45
remove shutdown logic from PluginManager and add a add_cleanup() API
...
for the already existing cleanup logic of the config object.
This simplifies lifecycle management as we don't keep two
layers of shutdown functions and also simplifies the pluginmanager
interface.
also add some docstrings.
--HG--
branch : plugin_no_pytest
2015-04-22 16:33:20 +02:00
holger krekel
7049ebe4e2
avoid prepend to register api as it's redundant wrt to hooks
...
--HG--
branch : plugin_no_pytest
2015-04-22 13:31:46 +02:00
holger krekel
1ef49ac5ab
minimize HookRelay to become a pure container, refactor initialization and
...
tests of plugin management to be a bit better split between pytest
and pytest-independent bits
--HG--
branch : plugin_no_pytest
2015-04-22 13:31:46 +02:00
holger krekel
d73e689991
fix issue616 - conftest visibility fixes. This is achieved by
...
refactoring how nodeid's are constructed. They now are always
relative to the "common rootdir" of a test run which is determined by
finding a common ancestor of all testrun arguments.
--HG--
branch : issue616
2015-02-26 21:56:44 +01:00
holger krekel
6ab36592ea
docs for "pytest_addhooks" hook. Thanks Bruno Oliveira.
...
updated plugin index docs. Thanks Bruno Oliveira.
fix issue557: with "-k" we only allow the old style "-" for negation
at the beginning of strings and even that is deprecated. Use "not" instead.
This should allow to pick parametrized tests where "-" appeared in the parameter.
2014-10-06 14:26:03 +02:00
Dj Gilcrease
fd2572a39d
change the defaults from a tuple to a list so I can use config.addinivalue_line("norecursedirs", "...") to append new options in my own plugins
...
--HG--
branch : dgilcrease/change-defaults-from-a-tuple-to-a-list-1412285169250
2014-10-02 21:27:19 +00:00
holger krekel
351931d5ca
call scanning of plugins directly, code is shifted from helpconfig.py to core.py
2014-10-01 12:20:11 +02:00
holger krekel
3de715ec13
refine internal management of plugins and conftest files
2014-10-01 12:19:11 +02:00
Floris Bruynooghe
7d9d502a01
Use py3k compatible .__getattr__() code
...
From the python-dev thread it seemed like using
object.__getattribute__(self, 'name') is the cleanest way of
implementing a class wich uses .__getattr__() and should be
pickelable. That only works on new-style classes so this also turns
HookProxy into a new-style class on py2.
This also re-writes the test to not use cPickle so it runs on py3k.
2014-09-05 23:55:14 +01:00
uweschmitt
224b3a2eda
hopefully final fix for strange infinite recursion bug
2014-08-11 12:57:47 +02:00
Bruno Oliveira
5603a0cd4b
Removing py.std usage from _pytest
2014-07-31 19:13:40 -03:00
holger krekel
d0b048c86d
Merged in msabramo/pytest/norecursedirs_add_star_dot_egg (pull request #177 )
...
Add *.egg to default for norecursedirs
2014-07-03 16:51:17 +02:00
Marc Abramowitz
b6f069f4c3
Add *.egg to default for norecursedirs
...
--HG--
branch : norecursedirs_add_star_dot_egg
2014-07-03 07:49:03 -07:00
holger krekel
07e76cbef2
fix issue364: shorten and enhance tracebacks representation by default.
...
The new "--tb=auto" option (default) will only display long tracebacks
for the first and last entry. You can get the old behaviour of printing
all entries as long entries with "--tb=long". Also short entries by
default are now printed very similarly to "--tb=native" ones.
2014-06-29 13:32:53 +02:00
Christian Henz
b7f6a9f3fd
Cleaner implementation of early handling of the '-c' command line switch.
...
--HG--
branch : explicit-ini-filename
2014-06-28 12:03:55 +02:00
christian@christian-linux.sarrazin.local
c8264385ea
Implement the "-c" command line switch that allows to explicitly specifiy the config file to load.
...
This feature was requested in issue #174 .
--HG--
branch : explicit-ini-filename
2014-06-27 17:42:37 +02:00
holger krekel
f984e94fca
Merged in jurko/pytest/break_ExceptionInfo_reference_cycles (pull request #144 )
...
break reference cycles caused by storing local reference to exception info
2014-04-03 09:47:41 +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
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
7b63fa5966
merge in current default
2014-03-27 13:57:54 +01:00
schlamar
77e1f93ca1
Fixed pyflakes errors.
2014-03-14 14:25:36 +01:00
schlamar
94b1ce65c6
Fixed race condition with SkipTest when module not in sys.modules on collection.
2014-03-14 14:04:54 +01:00
holger krekel
b47fdbe0a7
remove externally setting and dealing with "item.outerr" from capturing in favor of a direct interface for adding reporting sections to items.
...
* * *
refactor makereport implementation to avoid recursion with __multicall__
2014-03-14 12:49:34 +01:00
holger krekel
1b387bea62
introduce warning system with this API:
...
- node.warn() for a node-specific warning
- config.warn() for a global non-node specific warning
Each warning is accompanied by a "warning number" so that we can later
introduce mechanisms for surpressing them.
Each warning will trigger a call to pytest_report_warn(number, node, message)
which is by default implemented by the TerminalReporter which introduces
a new option "-rw" to show details about warnings.
2014-03-11 22:10:17 +01:00
Ronny Pfannschmidt
97da43d909
merge from default
...
--HG--
branch : multi-usageerror
2014-01-25 10:42:21 +01:00
Jurko Gospodnetić
9fb2079458
replace py.test module references with pytest
...
The only remaining 'py.test' references are:
* those referring to the 'py.test' executable
* those in code explicitly testing py.test/pytest module compatibility
* those in old CHANGES documentation
* those in documentation generated based on external data
* those in seemingly unfinished & unmaintained Japanese documentation
Minor stylistic changes and typo corrections made to documentation next to
several applied py.test --> pytest content changes.
2014-01-18 12:31:33 +01:00
holger krekel
426907eafb
radically simplify eq/neq with nodes by just using Pythons builtin "is" relationship.
...
The need for comparing two separately instantiated nodes seems to be historic
(related to an already-gone mode of pytest-xdist which would re-collect nodes)
and not actually needed anymore.
2013-12-07 16:39:53 +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
0a8b27ff49
fix ordering when mock.patch or other standard decorator-wrappings
...
are used with test methods. This fixues issue346. Thanks to
Ronny Pfannschmidt and Donald Stufft for helping to isolate it.
2013-11-19 23:22:27 +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
2248a31a44
more fixes regarding marking, in particular plugins should use add_marker/get_marker now.
2013-10-03 15:43:56 +02:00
holger krekel
e49eca8d59
simplify the implementation of NodeKeywords getting rid of __ descriptors appearing there.
2013-10-03 13:53:22 +02:00
holger krekel
05f6422392
remove unused imports (using "importchecker" project)
2013-10-02 14:32:40 +02:00
holger krekel
4b709037ab
some more separation of core pluginmanager from pytest specific functionality.
...
Idea is to have the PluginManager be re-useable from other projects at some point.
2013-09-30 13:14:14 +02:00
holger krekel
d946299b0a
shift pytest_configure/unconfigure/addoption/namespace hook calling to config object.
...
The _pytest.config module itself is no longer a plugin but the actual
config instance is plugin-registered as ``pytestconfig``.
This allows to put most pytest specific logic to _pytest.config instead
of in the core pluginmanager.
2013-09-30 13:14:14 +02:00
holger krekel
a930f44e60
introduce pluginmanager.ensure_teardown() which allows
2013-09-28 22:23:00 +02:00
Ronny Pfannschmidt
cf37c477bb
output errors for all failures of specific collection
...
when issueing a command with many specific items to collect,
print all collect failures instead of just the first one
--HG--
branch : multi-usageerror
2013-09-08 22:26:51 +02:00
holger krekel
94ee37cdb3
- fix issue181: --pdb now also works on collect errors. This was
...
implemented by a slight internal refactoring and the introduction
of a new hook ``pytest_exception_interact`` hook.
- fix issue341: introduce new experimental hook for IDEs/terminals to
intercept debugging: ``pytest_exception_interact(node, call, report)``.
2013-09-06 11:56:04 +02:00
holger krekel
8360c1e687
xfail some tests for doctest support if pdbpp is installed
2013-09-06 10:07:06 +02:00
holger krekel
ca7c1f5d8e
merge pull request #27 : correctly handle nose.SkipTest during collection. Thanks
...
Antonio Cuni, Ronny Pfannschmidt. I did a few tweaks to the test and the
activation (depending on if unittest is imported at all).
2013-08-16 11:33:58 +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
Anthon van der Neut
e96da76c3b
changes to addoption() for hyphenated long-options
...
--HG--
branch : opt-drop-non-hyphened-long-options
2013-08-01 16:49:26 +02:00
Anthon van der Neut
15ec5a898c
moving from optparse to argparse. Major difficulty is
...
that argparse does not have Option objects -> added class Argument
Needed explicit call of MyOptionParser.format_epilog as argparse
does not have that. The parse_arg epilog argument wraps the text,
which is not the same (could be handled with a special formatter).
- parser.parse() now returns single argument (with positional args in
.file_or_dir)
- "file_or_dir" made a class variable Config._file_or_dir and used in help and tests
- added code for argcomplete (because of which this all started!)
addoption:
- if option type is a string ('int' or 'string', this converted to
int resp. str
- if option type is 'count' this is changed to the type of choices[0]
testing:
- added tests for Argument
- test_mark.test_keyword_extra split as ['-k', '-mykeyword'] generates argparse
error test split in two and one marked as fail
- testing hints, multiline and more strickt (for if someone moves format_epilog
to epilog argument of parse_args without Formatter)
- test for destination derived from long option with internal dash
- renamed second test_parseopt.test_parse() to test_parse2 as it was
not tested at all (the first was tested.)
--HG--
branch : argparse
2013-07-25 15:33:43 +02:00
holger krekel
ac3d8800fd
make sessionfinish hooks execute with the same cwd-context as at
...
session start (helps fix plugin behaviour which write output files
with relative path such as pytest-cov)
2013-06-10 10:09:28 +02:00
Wouter van Ackooy
212f4b4d64
Issue 306: Used a set for the extra_keywords, and used listchain for parent iteration.
2013-05-27 18:14:35 +02:00
Wouter van Ackooy
fe27f3cc7d
Fixed issue #306 : Keywords and markers are now matched in a defined way. Also applied some pep8 formatting while fixing.
2013-05-20 14:37:58 +02:00
Antonio Cuni
ba0100e057
(antocuni, ronny around): import directly from _pytest.runner to avoid the usage of @property
2013-03-14 16:53:57 +01:00
Antonio Cuni
37c47155e0
correctly handle nose.SkipTest during collection
2013-03-14 16:10:33 +01:00
Ronny Pfannschmidt
ca8b3c2307
unify logic for error exit on test failures
2013-02-14 12:13:04 +01:00
holger krekel
05c86aeb28
make sure ihook uses a node's fspath - important for hooks
...
e.g. during a Module's collect to pick up conftest.py files
residing in the same dir
2012-10-22 16:12:22 +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
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
Ronny Pfannschmidt
bee7543716
move Item.applymarker to Node, and defer to it from Funcargrequest.applymarker
2012-09-30 22:17:33 +02:00
Ronny Pfannschmidt
9568ff3b23
backout, the _memoizedcall change worked only due to a local effect
2012-09-24 11:36:24 +02:00
Ronny Pfannschmidt
6e5f491a42
get rid of _memoizedcall - we dont really need it anymore
2012-09-24 11:26:38 +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
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
holger krekel
dd268c1b2b
improve error representation for missing factory definitions
...
in recursive funcarg reconstruction
2012-08-08 11:48:53 +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
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
396045e53f
allow registration of "funcarg" marked factories
2012-07-20 14:16:49 +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
4766497515
V3 draft of resource api
2012-07-16 11:11:26 +02:00
holger krekel
7a90bed19b
V1 of the resources API draft
2012-07-16 10:47:00 +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
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
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
42d44bfd43
fix some pep8 issues, more to go ... is there a tool that helps with pep8-ifying?
2012-06-21 11:20:29 +02:00
holger krekel
ccc04b9fc4
some refinements to reporting and hook order
2012-06-21 11:07:22 +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
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
c4fe622b82
fix issue93 - avoid "delayed" teardowns for distributed testing by
...
simplifying handling of teardowns.
2011-12-02 21:00:19 +00:00
Ronny Pfannschmidt
0c8e71faa5
simplify the loop in Node.listchain
2011-12-01 19:36:44 +01:00
holger krekel
a1d41c6811
remove a hack that isn't needed because runtestprotocol now memorizes pending teardowns and thus dist-testing has "exact" teardowns as well
2011-11-18 16:58:21 +00: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
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
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
Ronny Pfannschmidt
761a95e542
fix some of my typos, thanks Arfrever
2011-10-27 07:38:44 +02:00
Ronny Pfannschmidt
2c230f910d
fix issue74 - propperly filter out missfit names in _tryconvertpyarg
2011-10-26 22:40:08 +02:00
Florian Mayer
0e05a4fbcf
Improve --pyargs.
...
Don't evaluate modules and do nto show 'module not found' if ImportError is
thrown in the module.
2011-09-01 16:19:16 +02:00
holger krekel
e3b2792677
fix issue49 - avoid confusing errors when initialization goes wrong
2011-06-01 14:54:34 +02:00
Benjamin Peterson
cf6949c9a3
stuff contents of pytest_collection hook into perform_collect
2011-05-26 19:53:47 -05:00
Benjamin Peterson
2f984e0c23
remove after_initial_collect hook
2011-05-26 19:43:02 -05:00
Benjamin Peterson
0a7237b72f
refactor common config/session protocol code for main() functions
2011-05-26 19:09:42 -05:00
Benjamin Peterson
f684a9ed56
expose Session on pytest namespace
2011-05-26 18:58:31 -05:00
Benjamin Peterson
196cece338
add a hook called after the inital fs collection
2011-05-26 18:57:37 -05: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
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
07cee24122
avoid deprecation warnings for our internal accesses
2011-03-05 14:16:27 +01:00
holger krekel
74b9ebc1cd
accept a left out "()" for ids on command line for better compatibility with pytest.vim
2011-02-07 11:09:42 +01:00
holger krekel
762ea71f67
fix error reporting issue when a "pyc" file has no relating "py"
2011-01-27 21:11:21 +01:00
holger krekel
b8f0d10f80
fix a pypy related regression - re-allow self.NAME style collection tree customization
2011-01-18 12:47:31 +01:00
holger krekel
c7531705fc
refine plugin registration, allow new "-p no:NAME" way to prevent/undo plugin registration
2010-12-06 16:54:42 +01:00