Commit Graph

800 Commits

Author SHA1 Message Date
holger krekel 4800aeaef7 Merged in markon/pytest (pull request #66)
Fix @parametrize.
2013-08-16 11:38:00 +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
Marco Buccini f5a6a84314 test marked as 2013-08-16 09:55:25 +02:00
Marco Buccini 6c54ee03de Fix @parametrize when using an integer and strings as parameters in a test accepting a parameter and a fixture as arguments. 2013-08-15 12:52:34 +02:00
Anatoly Bubenkov 0cd7effe35 fix broken python3 and python2.5 tests
--HG--
branch : fix-broken-tests
2013-08-15 11:52:55 +02:00
Anatoly Bubenkov 722b35b0a6 tests for fixture finalizers
--HG--
branch : overriden-fixture-finalizer
2013-08-14 13:58:59 +02:00
holger krekel 4b88d6d2d7 monkeypatch.replace() now only accepts a string. Improved error handling and
docs thanks to suggestions from flub, pelme, schmir, ronny.
2013-08-07 16:49:29 +02:00
holger krekel 407283ef81 a new monkeypatch.replace(target, value) call which derives the
monkeypatch location from target (can be class/module/function or
string which is taken as importable python path)
examples:

    monkeypatch.replace(os.path.abspath, lambda x: "")
    monkeypatch.replace("requests.get", ...)
2013-08-07 15:35:27 +02:00
Anthon van der Neut 719e89fc1a argcomplete: FastFileCompleter that doesn't call bash in subprocess, strip prefix dir
```
timeit result for 10000 iterations of expanding '/d' (lowered the count in the code afterwards)
#                      2.7.5     3.3.2
# FilesCompleter       75.1109   69.2116
# FastFilesCompleter    0.7383    1.0760
```
- does not display prefix dir (like bash, not like compgen), py.test /usr/<TAB> does not show /usr/bin/ but bin/
2013-08-06 15:33:27 +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
Ronny Pfannschmidt 3b85a56db2 merge 2013-08-01 22:55:16 +02:00
Ronny Pfannschmidt 743711cd1f fix issue317: assertion rewriter support for the is_package method 2013-08-01 22:11:18 +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
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 e24b56af6c removed two superfluous parser arguments
--HG--
branch : opt-drop-non-hyphened-long-options
2013-08-01 16:27:06 +02:00
Anthon van der Neut 007a77c2ba drop help for long options if longer versions with hyphens are available
--HG--
branch : opt-drop-non-hyphened-long-options
2013-08-01 16:21:33 +02:00
holger krekel 9ccd52d538 fix issue305 - ignore any problems in writing a pyc file, but print out a trace. 2013-08-01 15:43:42 +02:00
holger krekel cbbbfcd101 fix collection imports for python2.5 2013-08-01 15:38:03 +02:00
Mathieu Agopian 72a48d69cd refs #279: sequence assertions can also deal with (Mutable)Sequence instances 2013-08-01 14:48:34 +02:00
holger krekel b90d82c17f fix some py33 issues introduced with rev 2985
--HG--
branch : argcomplete
2013-08-01 14:24:25 +02:00
Anthon van der Neut ef2ddb6f16 monkeypatch for os.environment changes
--HG--
branch : argcomplete
2013-07-31 21:33:13 +02:00
Anthon van der Neut e3a2e1bbf8 fix for tests running subprocesses of py.test after test_argcomplete
(which all still ran with argcompletion enabled) -> fail

--HG--
branch : argcomplete
2013-07-31 16:03:53 +02:00
Anthon van der Neut 6817a56270 minor adjustment, added test for positional argument completion
--HG--
branch : argcomplete
2013-07-30 12:33:38 +02:00
Anthon van der Neut 87860600fb Fixes for argcomplete
- separate out most argcomplete related stuff in new file _argcomplete.py
  (could probably be in the py library)
- allow positional arguments to be interspaced with optional arguments
  ( + test in test_parseopt.py )
- removed double argument in tox.ini
- add documentation on installing argcomplete (>=0.5.7 as needed for
  Python 3), might need improving/incorporation in index.

This does not work on 2.5 yet. I have patches for argcomplete
(with/print()/"".format) but I am not sure they will be accepted.
Agreed with hpk not to push for that.

Removing argcomplete and leaving completion code active now works by early
exit, so <TAB> no longer re-runs the programs without parameters
(which took long for py.test)

test calls bash with a script that redirects filedescriptor 8 (as used by
argcomplete), so the result can be tested.

--HG--
branch : argcomplete
2013-07-30 11:26:15 +02:00
holger krekel 377f63085a be more liberal with respect to lsof checks because jenkins keeps some files open 2013-07-29 15:39:24 +02:00
holger krekel 2a7c79dbf5 make genscript provide information as to compatibility
(now that argparse is a dependency on python2.6)
2013-07-26 08:59:31 +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 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
holger krekel 60a53c75a6 some python2.5/3.3 fixes of Brianna's parametrize improvements 2013-07-16 15:43:20 +02:00
holger krekel af7db5195b Merged in pfctdayelise/pytest (pull request #38)
A couple of improvements to parametrize
2013-07-16 15:30:48 +02:00
Anatoly Bubenkov 87eae6213e fixes for py25 in test_skipping 2013-07-11 11:15:31 +02:00
holger krekel 13ddce2381 fix issue320 - fix class scope for fixtures when mixed with
module-level functions.  Thanks Anatloy Bubenkoff.
2013-07-08 15:54:38 +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
holger krekel f7a9beaefb Merged in bubenkoff/pytest/329-skipif-requires-expression-as-a-string (pull request #43)
re #329 add test for skipif failure when you pass boolean without the reason. add emphasize to the docs.
2013-07-06 20:13:27 +02:00
Anatoly Bubenkov 214793f697 re #329 add test for skipif failure when you pass boolean without the reason. add emphasize to the docs.
--HG--
branch : 329-skipif-requires-expression-as-a-string
2013-07-06 18:54: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
Katarzyna Jachim ffa1bf726d merge 2013-07-06 15:54:33 +02:00
Katarzyna Jachim 87df85f12d improved reporting
added intermediate level of quiet reporting:
 * -q now shows short summary (# passed/failed tests + time)
 * the former -q is now -qq
2013-07-06 15:43:59 +02:00
Anatoly Bubenkov ea7a997afc remove unnecessary print 2013-07-06 10:26:14 +02:00
Anatoly Bubenkov 2c7613c15c merge with upstream 2013-07-06 10:06:12 +02:00
holger krekel c4c966683c fix issue323 - parametrize() of many module-scoped params 2013-06-28 12:57:10 +02:00
Brian Okken 28b2859718 change how the test is called 2013-06-22 09:42:31 -07:00
Brian Okken 5e77eb23eb add test_unittest_style_setup_teardown()
to test setUpModule() and tearDownModule()
2013-06-22 09:35:10 -07: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
Erik Bray 17e1106584 reindent a few of the blockquotes in these tests 2013-06-07 17:30:10 -04:00
Brianna Laugher 345b8391c4 A couple of improvements to parametrize
- When not specifying ids, let None and bools use their native string form (like str, int, float) rather than obfuscated form used for objects
- When specifying ids, explicitly raise a ValueError if a different number of ids are specified compared to the test cases
- Add tests for both these items.
2013-05-29 12:59:47 +10:00
Erik Bray b1595d3f61 Adds a test for and fixes #112. If attempting to write to the __pycache__ directory raises a permission error _write_pyc() should just return False to prevent any further write attempts. 2013-05-28 18:11:12 -04:00
holger krekel c294a417bd allow to specify parametrize inputs as a comma-separated string
add Wouter to changelog and to authors
2013-05-28 10:32:54 +02:00