apama.basetest module

class apama.basetest.ApamaBaseTest(descriptor, outsubdir, runner)[source]

Bases: pysys.basetest.BaseTest

A custom PySys basetest for Apama tests.

__init__(descriptor, outsubdir, runner)[source]

Create an instance of the BaseTest class.

Parameters:
  • descriptor – The descriptor for the test giving all test details
  • outsubdir – The output subdirectory the test output will be written to
  • runner – Reference to the runner responsable for executing the testcase
getDefaultFileEncoding(file, **xargs)[source]

Specifies what encoding should be used to read or write the specified text file.

This method is used to select the appropriate encoding whenever PySys needs to open a file, for example to wait for a signal, for a file-based assertion, or to write a file with replacements. Many methods allow the encoding to be overridden for just that call, but getDefaultFileEncoding exists to allow global defaults to be specified based on the filename.

For example, this method could be overridden to specify that utf-8 encoding is to be used for opening filenames ending in .xml, .json and .yaml.

A return value of None indicates default behaviour, which on Python 3 is to use the default encoding, as specified by python’s locale.getpreferredencoding(), and on Python 2 is to use binary “str” objects with no character encoding or decoding applied.

Parameters:
  • file – The filename to be read or written. This may be an absolute path or a relative path.
  • xargs – Ensure that an **xargs argument is specified so that additional information can be passed to this method in future releases.
Returns:

The encoding to use for this file, or None if default behaviour is to be used.