reshuffle/refine option grouping, introduce "terminal reporting options"
--HG-- branch : trunk
This commit is contained in:
		
							parent
							
								
									80f3e33e41
								
							
						
					
					
						commit
						c38bb72205
					
				|  | @ -89,11 +89,11 @@ import os | ||||||
| 
 | 
 | ||||||
| def pytest_addoption(parser): | def pytest_addoption(parser): | ||||||
|     group = parser.getgroup("general") |     group = parser.getgroup("general") | ||||||
|     group._addoption('-s', action="store_const", const="no", dest="capture",  |  | ||||||
|         help="shortcut for --capture=no.") |  | ||||||
|     group._addoption('--capture', action="store", default=None, |     group._addoption('--capture', action="store", default=None, | ||||||
|         metavar="method", type="choice", choices=['fd', 'sys', 'no'], |         metavar="method", type="choice", choices=['fd', 'sys', 'no'], | ||||||
|         help="set capturing method during tests: fd (default)|sys|no.") |         help="set capturing method during tests: fd (default)|sys|no.") | ||||||
|  |     group._addoption('-s', action="store_const", const="no", dest="capture",  | ||||||
|  |         help="shortcut for --capture=no.") | ||||||
| 
 | 
 | ||||||
| def addouterr(rep, outerr): | def addouterr(rep, outerr): | ||||||
|     repr = getattr(rep, 'longrepr', None) |     repr = getattr(rep, 'longrepr', None) | ||||||
|  |  | ||||||
|  | @ -44,9 +44,7 @@ def pytest_report_iteminfo(item): | ||||||
|     return item.reportinfo() |     return item.reportinfo() | ||||||
| 
 | 
 | ||||||
| def pytest_addoption(parser): | def pytest_addoption(parser): | ||||||
|     group = parser.getgroup("general", "general testing options") |     group = parser.getgroup("general", "running and selection options") | ||||||
|     group._addoption('-v', '--verbose', action="count",  |  | ||||||
|                dest="verbose", default=0, help="increase verbosity."), |  | ||||||
|     group._addoption('-x', '--exitfirst', |     group._addoption('-x', '--exitfirst', | ||||||
|                action="store_true", dest="exitfirst", default=False, |                action="store_true", dest="exitfirst", default=False, | ||||||
|                help="exit instantly on first error or failed test."), |                help="exit instantly on first error or failed test."), | ||||||
|  | @ -56,16 +54,6 @@ def pytest_addoption(parser): | ||||||
|              "space separated keywords.  precede a keyword with '-' to negate. " |              "space separated keywords.  precede a keyword with '-' to negate. " | ||||||
|              "Terminate the expression with ':' to treat a match as a signal " |              "Terminate the expression with ':' to treat a match as a signal " | ||||||
|              "to run all subsequent tests. ") |              "to run all subsequent tests. ") | ||||||
|     group._addoption('-l', '--showlocals', |  | ||||||
|                action="store_true", dest="showlocals", default=False, |  | ||||||
|                help="show locals in tracebacks (disabled by default).") |  | ||||||
|     #group._addoption('--showskipsummary', |  | ||||||
|     #           action="store_true", dest="showskipsummary", default=False, |  | ||||||
|     #           help="always show summary of skipped tests")  |  | ||||||
|     group._addoption('--tb', metavar="style",  |  | ||||||
|                action="store", dest="tbstyle", default='long', |  | ||||||
|                type="choice", choices=['long', 'short', 'no'], |  | ||||||
|                help="traceback verboseness (long/short/no).") |  | ||||||
|     group._addoption('-p', action="append", dest="plugins", default = [], |     group._addoption('-p', action="append", dest="plugins", default = [], | ||||||
|                help=("load the specified plugin after command line parsing. ")) |                help=("load the specified plugin after command line parsing. ")) | ||||||
|     if execnet: |     if execnet: | ||||||
|  |  | ||||||
|  | @ -7,6 +7,23 @@ import py | ||||||
| import sys | import sys | ||||||
| 
 | 
 | ||||||
| def pytest_addoption(parser): | def pytest_addoption(parser): | ||||||
|  |     group = parser.getgroup("terminal reporting", after="general") | ||||||
|  |     group._addoption('-v', '--verbose', action="count",  | ||||||
|  |                dest="verbose", default=0, help="increase verbosity."), | ||||||
|  |     group._addoption('-l', '--showlocals', | ||||||
|  |                action="store_true", dest="showlocals", default=False, | ||||||
|  |                help="show locals in tracebacks (disabled by default).") | ||||||
|  |     group.addoption('--report', | ||||||
|  |                action="store", dest="report", default=None, metavar="opts", | ||||||
|  |                help="comma separated reporting options") | ||||||
|  |     group._addoption('--tb', metavar="style",  | ||||||
|  |                action="store", dest="tbstyle", default='long', | ||||||
|  |                type="choice", choices=['long', 'short', 'no'], | ||||||
|  |                help="traceback verboseness (long/short/no).") | ||||||
|  |     group._addoption('--fulltrace', | ||||||
|  |                action="store_true", dest="fulltrace", default=False, | ||||||
|  |                help="don't cut any tracebacks (default is to cut).") | ||||||
|  | 
 | ||||||
|     group = parser.getgroup("debugconfig") |     group = parser.getgroup("debugconfig") | ||||||
|     group.addoption('--collectonly', |     group.addoption('--collectonly', | ||||||
|         action="store_true", dest="collectonly", |         action="store_true", dest="collectonly", | ||||||
|  | @ -17,15 +34,9 @@ def pytest_addoption(parser): | ||||||
|     group._addoption('--nomagic', |     group._addoption('--nomagic', | ||||||
|                action="store_true", dest="nomagic", default=False, |                action="store_true", dest="nomagic", default=False, | ||||||
|                help="don't reinterpret asserts, no traceback cutting. ") |                help="don't reinterpret asserts, no traceback cutting. ") | ||||||
|     group._addoption('--fulltrace', |  | ||||||
|                action="store_true", dest="fulltrace", default=False, |  | ||||||
|                help="don't cut any tracebacks (default is to cut).") |  | ||||||
|     group.addoption('--debug', |     group.addoption('--debug', | ||||||
|                action="store_true", dest="debug", default=False, |                action="store_true", dest="debug", default=False, | ||||||
|                help="generate and show debugging information.") |                help="generate and show internal debugging information.") | ||||||
|     group.addoption('--report', |  | ||||||
|                action="store", dest="report", default=None, metavar="opts", |  | ||||||
|                help="comma separated reporting options") |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def pytest_configure(config): | def pytest_configure(config): | ||||||
|  |  | ||||||
|  | @ -1,6 +1,8 @@ | ||||||
| Changes between 1.0.2 and '1.1.0b1' | Changes between 1.0.2 and '1.1.0b1' | ||||||
| ===================================== | ===================================== | ||||||
| 
 | 
 | ||||||
|  | * reshuffle / refine command line grouping | ||||||
|  | 
 | ||||||
| * deprecate parser.addgroup in favour of getgroup which creates option group | * deprecate parser.addgroup in favour of getgroup which creates option group | ||||||
| 
 | 
 | ||||||
| * add --report command line option that allows to control showing of skipped/xfailed sections  | * add --report command line option that allows to control showing of skipped/xfailed sections  | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue