I have a PythonTestSuite and I'm trying to pass --help to the underlying py.test runner to see what flags are available. I've tried a variety of invocations [1, 2, 3] but don't seem to be having much luck. Any chance someone on this list knows the correct invocation? I'm using pants 0.0.23.
~aurora git aurora/. master
% ./pants build src/test/python:all -- --help
Traceback (most recent call last):
File "/home/ksweeney/workspace/aurora/build-support/pantsbuild.pants-0.0.23.pex/.bootstrap/_twitter_common_python/pex.py", line 223, in execute
self.execute_entry(entry_point, args)
File "/home/ksweeney/workspace/aurora/build-support/pantsbuild.pants-0.0.23.pex/.bootstrap/_twitter_common_python/pex.py", line 271, in execute_entry
runner(entry_point)
File "/home/ksweeney/workspace/aurora/build-support/pantsbuild.pants-0.0.23.pex/.bootstrap/_twitter_common_python/pex.py", line 294, in execute_pkg_resources
runner()
File "/home/ksweeney/.pex/install/pantsbuild.pants-0.0.23-py2-none-any.whl.fd4e72ce8848430b51d614ea7daf243505ca94fc/pantsbuild.pants-0.0.23-py2-none-any.whl/pants/bin/pants_exe.py", line 196, in main
_run()
File "/home/ksweeney/.pex/install/pantsbuild.pants-0.0.23-py2-none-any.whl.fd4e72ce8848430b51d614ea7daf243505ca94fc/pantsbuild.pants-0.0.23-py2-none-any.whl/pants/bin/pants_exe.py", line 164, in _run
build_graph)
File "/home/ksweeney/.pex/install/pantsbuild.pants-0.0.23-py2-none-any.whl.fd4e72ce8848430b51d614ea7daf243505ca94fc/pantsbuild.pants-0.0.23-py2-none-any.whl/pants/commands/goal_runner.py", line 114, in __init__
super(GoalRunner, self).__init__(*args, **kwargs)
File "/home/ksweeney/.pex/install/pantsbuild.pants-0.0.23-py2-none-any.whl.fd4e72ce8848430b51d614ea7daf243505ca94fc/pantsbuild.pants-0.0.23-py2-none-any.whl/pants/commands/command.py", line 79, in __init__
self.setup_parser(parser, args)
File "/home/ksweeney/.pex/install/pantsbuild.pants-0.0.23-py2-none-any.whl.fd4e72ce8848430b51d614ea7daf243505ca94fc/pantsbuild.pants-0.0.23-py2-none-any.whl/pants/commands/goal_runner.py", line 171, in setup_parser
goals, specs = GoalRunner.parse_args(non_help_args)
File "/home/ksweeney/.pex/install/pantsbuild.pants-0.0.23-py2-none-any.whl.fd4e72ce8848430b51d614ea7daf243505ca94fc/pantsbuild.pants-0.0.23-py2-none-any.whl/pants/commands/goal_runner.py", line 93, in parse_args
'Cannot intermix targets with goals when using --. Targets should appear on the right')
IntermixedArgumentsError: Cannot intermix targets with goals when using --. Targets should appear on the right
% ./pants build src/test/python:all --help
Usage:
./pants goal [option ...] [goal ...] [target...] Attempt the specified goals.
./pants goal help Get help.
./pants goal help [goal] Get help for the specified goal.
./pants goal goals List all installed goals.
[target] accepts two special forms:
dir: to include all targets in the specified directory.
dir:: to include all targets found recursively under the directory.
Friendly docs:
Global options:
-h, --help Show this help message.
-t CONN_TIMEOUT, --timeout=CONN_TIMEOUT
Number of seconds to wait for http connections.
-x, --time Times goal phases and outputs a report.
-e, --explain Explain the execution of goals.
-k, --kill-nailguns Kill nailguns before exiting
-d LOGDIR, --logdir=LOGDIR
[none] Write logs to files under this directory.
-l LOG_LEVEL, --level=LOG_LEVEL
[info] Set the logging level [debug, info, warn].
-q, --quiet Squelches all console output apart from errors.
-i INTERPRETER, --interpreter=INTERPRETER
Constrain what Python interpreters to use. Uses
Requirement format from pkg_resources, e.g.
'CPython>=2.6,<3' or 'PyPy'. By default, no
constraints are used. Multiple constraints may be
added. They will be ORed together.
--no-colors Do not colorize log messages.
--no-lock Don't attempt to grab the global lock. This lock
prevents two concurrent pants instances from stomping
on each others data, so only use this if you know what
you're doing.
--read-from-artifact-cache, --no-read-from-artifact-cache
Read build artifacts from cache, if available.
--exclude-target-regexp=TARGET_EXCLUDES
Regex pattern to exclude from the target list (useful
in conjunction with ::). Multiple patterns may be
specified by setting this flag multiple times.
--write-to-artifact-cache, --no-write-to-artifact-cache
Write build artifacts to cache, if possible.
--print-exception-stacktrace
Print to console the full exception stack trace if
encountered.
[3] Looks like I tricked the parser into passing -h into the underlying runner - I get this output once per test.
% ./pants build src/test/python:all --hel
Build operating on top level addresses: set([BuildFileAddress(/home/ksweeney/workspace/aurora/src/test/python/BUILD, all)])
usage: tmpZfYKgX [options] [file_or_dir] [file_or_dir] [...]
positional arguments:
file_or_dir
general:
-k EXPRESSION only run tests which match the given substring
expression. An expression is a python evaluatable
expression where all names are substring-matched
against test names and their parent classes. Example:
-k 'test_method or test other' matches all test
functions and classes whose name contains
'test_method' or 'test_other'. Additionally keywords
are matched to classes and functions containing extra
names in their 'extra_keyword_matches' set, as well as
functions which have names assigned directly to them.
-m MARKEXPR only run tests matching given mark expression.
example: -m 'mark1 and not mark2'.
--markers show markers (builtin, plugin and per-project ones).
-x, --exitfirst exit instantly on first error or failed test.
--maxfail=num exit after first num failures or errors.
--strict run pytest in strict mode, warnings become errors.
-c file load configuration from `file` instead of trying to
locate one of the implicit configuration files.
--fixtures, --funcargs
show available fixtures, sorted by plugin appearance
--pdb start the interactive Python debugger on errors.
--capture=method per-test capturing method: one of fd|sys|no.
-s shortcut for --capture=no.
--runxfail run tests even if they are marked xfail
reporting:
-v, --verbose increase verbosity.
-q, --quiet decrease verbosity.
-r chars show extra test summary info as specified by chars
(f)ailed, (E)error, (s)skipped, (x)failed, (X)passed
(w)warnings.
-l, --showlocals show locals in tracebacks (disabled by default).
--report=opts (deprecated, use -r)
--tb=style traceback print mode (long/short/line/native/no).
--full-trace don't cut any tracebacks (default is to cut).
--color=color color terminal output (yes/no/auto).
--durations=N show N slowest setup/test durations (N=0 for all).
--pastebin=mode send failed|all info to bpaste.net pastebin service. --junit-xml=path create junit-xml style report file at given path.
--junit-prefix=str prepend prefix to classnames in junit-xml output
--result-log=path path for machine-readable result log.
collection:
--collect-only only collect tests, don't execute them.
--pyargs try to interpret all arguments as python packages.
--ignore=path ignore path during collection (multi-allowed).
--confcutdir=dir only load conftest.py's relative to specified dir.
--doctest-modules run doctests in all .py modules
--doctest-glob=pat doctests file matching pattern, default: test*.txt
test session debugging and configuration:
--basetemp=dir base temporary directory for this test run.
--version display pytest lib version and import information.
-h, --help show help message and configuration info
-p name early-load given plugin (multi-allowed). To avoid
loading of plugins, use the `no:` prefix, e.g.
`no:doctest`.
--trace-config trace considerations of conftest.py files.
--debug store internal tracing debug information in
'pytestdebug.log'.
--assert=MODE control assertion debugging tools. 'plain' performs no
assertion debugging. 'reinterp' reinterprets assert
statements after they failed to provide assertion
expression information. 'rewrite' (the default)
rewrites assert statements in test modules on import
to provide assert expression information.
--no-assert DEPRECATED equivalent to --assert=plain
--no-magic DEPRECATED equivalent to --assert=plain
--genscript=path create standalone pytest script at given target path.
coverage reporting with distributed testing support:
--cov=path measure coverage for filesystem path (multi-allowed)
--cov-report=type type of report to generate: term, term-missing,
annotate, html, xml (multi-allowed)
--cov-config=path config file for coverage, default: .coveragerc
--no-cov-on-fail do not report coverage if test run fails, default:
False
Interrupt test run and dump stacks of all threads after a test times out:
--timeout=TIMEOUT Timeout in seconds before dumping the stacks. Default
is 0 which means no timeout.
--timeout_method={signal,thread}
Depreacted, use --timeout-method
--timeout-method={signal,thread}
Timeout mechanism to use. 'signal' uses SIGALRM if
available, 'thread' uses a timer thread. The default
is to use 'signal' and fall back to 'thread'.
[pytest] ini-options in the next pytest.ini|tox.ini|setup.cfg file:
markers (linelist) markers for test functions
norecursedirs (args) directory patterns to avoid for recursion
usefixtures (args) list of default fixtures to be used with this project
python_files (args) glob-style file patterns for Python test module discovery
python_classes (args) prefixes for Python test class discovery
python_functions (args) prefixes for Python test function and method discovery
addopts (args) extra command line options
minversion (string) minimally required pytest version
timeout (string) Timeout in seconds before dumping the stacks. Default is 0 which
means no
timeout_method (string) Timeout mechanism to use. 'signal' uses SIGALRM if available,
'thread' use
to see available markers type: py.test --markers
to see available fixtures type: py.test --fixtures
(shown according to specified file_or_dir or current dir if not specified)