Apama 10.15.0 | Release Notes | What's New In Apama 10.5.0 | PySys changes in 10.5.0
 
PySys changes in 10.5.0
Apama 10.5.0 now ships a newer version of the PySys system testing framework, version 1.5.0.
PySys 1.4.0 includes improvements to the writer API such as integrated support for running tests using Travis CI. New test projects can be created with the new pysys.py makeproject command. Among other additions, it includes support for creating background threads from test cases, a new skipTest() method, an IS_WINDOWS constant, and a new stdouterr argument for ProcessUser.startProcess() which makes it easier to specify to which files process output is to be written. There are also some important bug fixes in areas such as international (I18N) character support, logging, assertion error handling, cleanliness of the startProcess environment, and process monitoring.
PySys 1.5.0 brings some significant new features, including support for running a test in multiple modes and pysysdirconfig.xml files that allow you to specify defaults that apply to all test cases under a particular directory - such as groups, modes, a prefix to add to the start of each test identifier, and a numeric hint to help define the execution order of your tests. There are also new features in the pysys run and pysys print command lines, and a host of small additions to the API to make test creation easier, for example, assertEval, copy (with filtering of each copied line) and write_text (for easy programmatic creation of files in the output directory).
If you are already familiar with PySys, it is strongly recommended to read the full PySys change log in detail to familiarize yourself with the new features and new best practices for improving how you write tests. You can find the PySys change log (PYSYS_CHANGELOG.html) in the doc/pydoc directory of your Apama installation, or you can access it from the API Reference for Python topic. There is more detail on many PySys features in the user guide (PYSYS_USERGUIDE.html) available in the same location.
PySys 1.4.0 and 1.5.0 include some changes that might require changes to existing tests, including:
*Stricter checking of unknown or invalid keyword arguments passed to assert* methods. Incorrect arguments that were silently ignored in previous releases will now result in a test failure to alert you to the fact that they need fixing.
*The environment variables passed to processes started by startProcess no longer include environment variables of the parent PySys process by default. Note that this does not affect correlator or IAF processes which continue to be started with the same environment variables as PySys itself.
*Changes to the API and the default columns of the memory/CPU process monitoring framework.
*It is now mandatory to provide a pysysproject.xml file in the root directory containing your tests.
*Errors and typos in pysystest.xml XML descriptors will now prevent any tests from running (previously, they were just logged). Since an invalid descriptor prevents the associated test case from reporting a result, the new behavior ensures such mistakes will be spotted and fixed promptly. If you have any non-PySys files under your PySys project root directory with names such as descriptor.xml which PySys would normally recognize as test cases, you can avoid errors by adding a .pysysignore file to prevent PySys looking into that part of the directory tree.
*ProcessUser.mkdir now returns the absolute path (including the output directory) instead of just the relative path that was passed in. This makes it easier to use in-line while performing operations such as creating a file in the new directory. Code that relied on the old behavior of returning the path that was passed in may need to be updated to avoid having the output directory specified twice. If you are using os.path.join, then no change will be required.
*If you have a custom BaseRunner subclass, note that the self.output variable in BaseRunner is no longer set to the current directory, but instead to a pysys-runner-OUTDIR subdirectory of the test root (or to OUTDIR/pysys-runner if OUTDIR is an absolute path). This directory is not created (or cleaned) automatically, so if you need to write to self.output, you should add code to do that to your runner.
*The PROJECT variable in the constants module is deprecated. Use self.project instead (which is defined on classes such as BaseTest and BaseRunner).
If you have existing PySys tests, we recommend copying some or all of the properties from APAMA_HOME/samples/pysys/pysysproject.xml into your own pysysproject.xml, especially supportMultipleModesPerRun, defaultAbortOnError, defaultIgnoreExitStatus, and the default-file-encodings section. However, this will change the behavior of existing tests. See the PySys documentation and change log for further details.
We also strongly recommend you to update the requires-pysys and requires-python elements in your pysysproject.xml, to ensure that anyone attempting to run them using an older version than they were designed for gets a clear error message rather than just a subtle difference in behavior.
See the Upgrade guide and compatibility section in the above mentioned PySys change log for further details.
The documentation has been updated with information on how to get started with PySys. See Testing Apama Applications Using PySys.