Commit Graph

42 Commits

Author SHA1 Message Date
Ronny Pfannschmidt b9a91dc112 merge from master to features 2016-07-06 11:51:48 +02:00
Daniel Hahler 939407ef63 Simplify Argument.__repr__
I have came across this when noticing that universal-ctags fails to parse
this correctly (https://github.com/universal-ctags/ctags/issues/997).
2016-06-25 09:31:31 +02:00
Stefan Zimmermann 69bab4ab04 added check for already existing option names to OptionGroup.addoption() 2016-06-22 18:01:35 +02:00
Dave Hunt ef9dd14963 Introduce pytest command as recommended entry point
Fixes #1629
2016-06-21 16:16:57 +02:00
Bruno Oliveira af893aab26 Remove code related to support python <= 2.5
Fix #1226
2015-12-16 16:16:22 -02:00
Bruno Oliveira 4533a50542 Fix regression caused by changing the signature for parse_known_args
Fix #973
2015-08-27 19:35:32 -03:00
Bruno Oliveira 42b43a7d7b Paths after normal options are now properly used to discover rootdir and ini files
Fix #949
2015-08-25 22:08:05 -03: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
holger krekel 0d17dc1e19 add a comment for why we only consider .py files when removing @
--HG--
branch : fix_initial_parsing
2014-07-28 13:56:10 +02:00
holger krekel 40eed363e8 fix issue544 by only removing "@NUM" at the end of a part (parts are
separated by "::") and if the part has an .py extension.

--HG--
branch : fix_initial_parsing
2014-07-28 12:07:15 +02: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 ebd10aa6b4 shrink and merge the somewhat obscure and undocumented internal hinting
system with the new warnings one
2014-03-11 22:10:51 +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 5aa5b9748d fix argcomplete-test to use sys.argv[0] if it looks like a py.test executable 2013-10-03 18:02:54 +02:00
holger krekel db6f347db6 fix issue358 -- introduce new pytest_load_initial_conftests hook and make capturing initialization use it, relying on a new (somewhat internal) parser.parse_known_args() method.
This also addresses issue359 -- plugins like pytest-django could implement a pytest_load_initial_conftests hook like the capture plugin.
2013-09-30 13:14:16 +02:00
holger krekel 8b1e53f6d3 avoid creation of file in os.getcwd() cc avanderneut 2013-09-30 08:36:31 +02:00
holger krekel b80e875525 move FILE_OR_DIR constant out 2013-09-28 09:52:41 +02:00
holger krekel ca5d02df06 another way how bash reacts when no argcomplete is there? 2013-09-05 22:32:35 +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 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 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 a698465487 streamline docs, especially use "import pytest" and "pytest.*" in python code examples instead of "import py" and "py.test.*". 2010-11-17 22:12:16 +01:00
holger krekel 929291775e flat is better than nested (cont'd):
- pytest.py is new module, making "python -m pytest" work always
- _pytest/*.py now contains core.py, hookspec and the plugins, no sub packages
2010-11-13 11:10:45 +01:00
holger krekel b6ec5a575d get option settings from ini-file. make getting configuration options from conftest.py only an internal feature.
--HG--
branch : trunk
2010-10-31 17:41:58 +01:00
holger krekel 1280041f0c add and document new parser.addini(name, description) method to describe
ini-values. Also document the parser object with its public methods.

--HG--
branch : trunk
2010-10-30 19:23:50 +02:00
holger krekel c9e629c870 remove old ways to set option defaults, relying on global setup.cfg or tox.ini files now.
revamp py.test --help-config

--HG--
branch : trunk
2010-10-27 22:29:01 +02:00
holger krekel f3fb91e296 remove all deprecated functionality and tests
--HG--
branch : trunk
2010-10-13 18:41:53 +02:00
holger krekel 04c41cb672 shift config initialization to own "config" plugin
--HG--
branch : trunk
2010-10-12 15:34:32 +02:00
holger krekel 6631447161 merge config, pluginmanager, main into one file
--HG--
branch : trunk
2010-10-12 12:54:32 +02:00
holger krekel 32fce34825 move config to _config
--HG--
branch : trunk
2010-10-10 13:48:49 +02:00
holger krekel d1aff902d5 remove pylib things and move things to new pytest namespace
--HG--
branch : trunk
2010-10-07 11:59:00 +02:00
holger krekel f488da5cc8 merge parseopt into config module
--HG--
branch : trunk
2010-10-07 13:26:07 +02:00
Benjamin Peterson d93016d85f remove the unused return value of fnmatch_lines
--HG--
branch : trunk
2010-04-28 17:12:38 -05:00
holger krekel 9da1ba40ed move down py/impl/XYZ to py/_XYZ
--HG--
branch : trunk
2010-01-13 17:15:54 +01:00
holger krekel 5c27076d32 flatten test directory hierarchy and merge smaller into larger files
--HG--
branch : trunk
2010-01-13 16:17:50 +01:00