pysys.launcher.console_make

Implements pysys.py make to create new testcases.

DefaultTestMaker

class pysys.launcher.console_make.DefaultTestMaker(name='make', **kwargs)[source]

Bases: object

The default implementation of pysys.py make, which creates tests and other assets using templates configurable on a per-directory basis using <maker-template> configuration in pysysdirconfig.xml (and project) files.

See Test Descriptors for information about how to configure templates.

A subclass can be specified in the project if further customization is required using:

<maker classname="myorg.MyTestMaker"/>
printUsage(**kwargs)[source]

Print help info and exit.

validateTestId(parentDir, prefix, numericSuffix, **kwargs)[source]

This method can be overridden to provide customized validation of a proposed new test directory name, for example to prevent clashes with existing tests committed to version control.

The default implementation of this method does nothing.

If validation fails, an exception should be thrown. The method can propose a new numericSuffix that will be used instead (only if auto-generating the test id) by raising an ProposeNewTestIdNumericSuffixException exception.

The command line option --skipValidation can be used to disable this checking, for example when disconnected from the network.

Parameters
  • parentDir (str) – The absolute path of the directory in which the test is to be created.

  • prefix (str) – The proposed test id, excluding any numeric suffix.

  • numericSuffix (str) – The numeric suffix (including padding), if any, or ‘’ if this is not a numeric test id.

Raises
  • ProposeNewTestIdNumericSuffixException – If an alternative numeric suffix would be acceptable. This is used when auto-generating test ids.

  • Exception – If the specific test id is not acceptable.

parseArgs(args)[source]

Parse the command line arguments after pysys make.

copy(source, dest, replace, **kwargs)[source]

Copies the specified source file/dir to the specified dest file/dir.

Can be overridden if any advanced post-processing is required.

makeTest()[source]

Uses the previously parsed arguments to create a new test (or related asset) on disk in self.dest.

Can be overridden if additional post-processing steps are required for some templates.

ProposeNewTestIdNumericSuffixException

class pysys.launcher.console_make.ProposeNewTestIdNumericSuffixException(reason, newNumericSuffix)[source]

Bases: Exception

This exception should be thrown by DefaultTestMaker.validateTestId if the specific test id cannot be used but the validator can propose an acceptable numeric suffix to use instead, typically with a higher number to avoid conflicts with tests committed to version control elsewhere.

Parameters
  • reason (str) – The error message to use if not auto-generating a new id.

  • newNumericSuffix (int) – The new numeric suffix

LegacyConsoleMakeTestHelper

class pysys.launcher.console_make.LegacyConsoleMakeTestHelper(name='')[source]

Bases: object

The legacy and deprecated implementation of pysys.py make - used only by existing custom subclasses.

Also known by its alias ConsoleMakeTestHelper.

printUsage()[source]

Print help info and exit.

parseArgs(args)[source]

Parse the command line arguments after pysys make.

makeTest(input=None, output=None, reference=None, descriptor=None, testclass=None, module=None, group='', constantsImport=None, basetestImport=None, basetest=None, teststring=None)[source]

Makes a new test on disk.

ConsoleMakeTestHelper

pysys.launcher.console_make.ConsoleMakeTestHelper

alias of pysys.launcher.console_make.LegacyConsoleMakeTestHelper