pysys.writer.console¶
Writers that record test outcomes on the console (stdout) when running PySys.
If no progress writers are explicitly configured in the PySys project XML file, an instance of
ConsoleProgressResultsWriter
is used. If no summary writer is explicitly configured in the PySys project
XML file, an instance of ConsoleSummaryResultsWriter
is used.
ConsoleSummaryResultsWriter¶
- class pysys.writer.console.ConsoleSummaryResultsWriter(logfile=None, **kwargs)[source]¶
Bases:
pysys.writer.api.BaseSummaryResultsWriter
,pysys.writer.api.TestOutcomeSummaryGenerator
Default summary writer that is used to list a summary of the test results at the end of execution.
Support the same configuration options as
pysys.writer.api.TestOutcomeSummaryGenerator
.
ConsoleProgressResultsWriter¶
- class pysys.writer.console.ConsoleProgressResultsWriter(**kwargs)[source]¶
Bases:
pysys.writer.api.BaseProgressResultsWriter
Default progress writer that logs a summary of progress so far to the console, after each test completes.
ConsoleFailureAnnotationsWriter¶
- class pysys.writer.console.ConsoleFailureAnnotationsWriter(logfile=None, **kwargs)[source]¶
Bases:
pysys.writer.api.BaseRecordResultsWriter
Writer that prints a single annotation line to stdout for each test failure, for IDEs and CI providers that can highlight failures using regular expression stdout parsing.
An instance of this writer is automatically added to every project, and enables itself only if the
PYSYS_CONSOLE_FAILURE_ANNOTATIONS
environment variable is set.This class is designed for simple cases. If you need to output in a format that requires escaping of special characters it is best to create a custom writer class.
- format = ''¶
The format that will be written to stdout. If the
PYSYS_CONSOLE_FAILURE_ANNOTATIONS
environment variable is set, the environment will be used instead.The format can include the following placeholders:
@testFile@
: the absolute path to the test file (e.g. pysystest.py/run.py), using platform-specific slashes.@testFile/@
: the absolute path to the test file, using forward slashes on all OSes.@testFileLine@
: the line number in the test file (if available, else 0).@runLogFile@
: the absolute path to the run log (e.g. run.log), using platform-specific slashes.@runLogFile/@
: the absolute path to the run log (e.g. run.log), using forward slashes on all OSes.@category@
: eithererror
or if it’s a non-failure outcome,warning
.@outcome@
: the outcome e.g.FAILED
.@outcomeReason@
: the string containing the reason for the failure; this string can contain any characters (other than newline).@testIdAndCycle@
: the test identifier, with an optional cycle suffix if this is a multi-cycle test run.@json@
: a JSON dict suitable for machine-parsing; seepysys.writer.outcomes.JSONResultsWriter
for details. Added in v2.1.
The default format when the environment variable is empty and a format configuration is not provided is given by
DEFAULT_FORMAT
.
- DEFAULT_FORMAT = '@testFile@:@testFileLine@: @category@: @outcome@ - @outcomeReason@ (@testIdAndCycle@)'¶
This is the default format if the environment variable is empty and
format
is not provided.The output looks like this:
c:\myproject\tests\MyTest_001\pysystest.py:4: error: TIMED OUT - This test timed out (MyTest_001 [CYCLE 03])
which is similar to output from “make” and so should be parseable by many tools and IDEs.
- includeNonFailureOutcomes = 'NOT VERIFIED'¶
In addition to failure outcomes, any outcomes listed here (as comma-separated display names) will be reported (with a
@category@
ofwarning
rather thanerror
).To include all non-failure outcomes, set this to the special value
"*"
.The environment variable
PYSYS_CONSOLE_FAILURE_ANNOTATIONS_INCLUDE_OUTCOMES
can be used to overriden the value of this configuration option, for example set it to*
to include all outcomes.
- enableIfEnvironmentVariable = 'PYSYS_CONSOLE_FAILURE_ANNOTATIONS'¶
The environment variable used to control whether it is enabled. If it is set to any value other than
true
then its value will be used to determine the format (see above).This writer will be enabled if the specified environment variable is set (either to any empty string or to any value other than “false”).
Set enableIfEnvironmentVariable to “” to ignore the environment and instead enable when running with
--record
.