Commit Graph

88 Commits

Author SHA1 Message Date
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