pysys.writer.ci¶
Contains writers for recording test results to Continuous Integration providers.
These writers only generate output in --record
mode, and only if the
environment variables associated with their CI system are set.
TravisCIWriter¶
-
class
pysys.writer.ci.
TravisCIWriter
(logfile=None, **kwargs)[source]¶ Bases:
pysys.writer.BaseRecordResultsWriter
Writer for Travis CI. Only enabled when running under Travis (specifically, if the
TRAVIS=true
environment variable is set).-
cleanup
(**kwargs)[source]¶ Called after all tests have finished executing (or been cancelled).
This is where file headers can be written, and open handles should be closed.
- Parameters
kwargs – Additional keyword arguments may be added in a future release.
-
isEnabled
(**kwargs)[source]¶ Determines whether this writer can be used in the current environment.
If set to False then after construction none of the other methods (including
setup
)) will be called.- Parameters
record – True if the user ran PySys with the
--record
flag, indicating that test results should be recorded.- Returns
For record writers, the default to enable only if record==True, but individual writers can use different criteria if desired, e.g. writers for logging output to a CI system may enable themselves based on environment variables indicating that system is present, even if record is not specified explicitly.
-
processResult
(testObj, cycle=0, testTime=0, testStart=0, runLogOutput='', **kwargs)[source]¶ Called when each test has completed.
This method is always invoked under a lock that prevents multiple concurrent invocations so additional locking is not usually necessary.
- Parameters
testObj (pysys.basetest.BaseTest) – Reference to an instance of a
pysys.basetest.BaseTest
class. The writer can extract data from this object but should not store a reference to it. ThetestObj.descriptor.id
indicates the test that ran.cycle (int) – The cycle number. These start from 0, so please add 1 to this value before using.
testTime (float) – Duration of the test in seconds as a floating point number.
testStart (float) – The time when the test started.
runLogOutput (str) – The logging output written to run.log, as a unicode character string.
kwargs – Additional keyword arguments may be added in future releases.
-
setup
(numTests=0, cycles=1, xargs=None, threads=0, testoutdir='', runner=None, **kwargs)[source]¶ Called before any tests begin.
Before this method is called, for each property “PROP” specified for this writer in the project configuration file, the configured value will be assigned to
self.PROP
.- Parameters
numTests – The total number of tests (cycles*testids) to be executed
cycles – The number of cycles.
xargs – The runner’s xargs
threads – The number of threads used for running tests.
testoutdir – The output directory used for this test run (equal to
runner.outsubdir
), an identifying string which often contains the platform, or when there are multiple test runs on the same machine may be used to distinguish between them. This is usually a relative path but may be an absolute path.runner – The runner instance that owns this writer.
kwargs – Additional keyword arguments may be added in a future release.
-