glaciation.testing package

Submodules

glaciation.testing.generic module

glaciation.testing.generic.checkVar(vdb, vardbs, variable, value, dontCheckQ=False, condition='==')[source]

Check if variable/s have a specific value.  Raise exception in case variable != value in any of the vardbs.

Parameters:
  • vdb (class VardbVarWrapper) – instance of VardbVarWrapper

  • vardbs (list of strings) – list of vardbs

  • variable (string) – variable name to be read

  • value (int) – variable value to be waiting for

  • dontCheckQ (bool) – if True, it will not raise exception in case of variable quality is NOK (0) (default is False)

  • condition (string) – if not None instead of checking (variable == value), it will check (variable condition value) (default is ‘==’)

Raises:

Exception – vardb variable FAILED in checkVar. Expected(), Read().

glaciation.testing.generic.checkVarDoesNotChange(vdb, vardbs, variable, value, timeoutSec=10, dontCheckQ=False)[source]

Check if in timeoutSec variable keeps the value.  Function will finish before timeout if any value is different from value.

Parameters:
  • vdb (class VardbVarWrapper) – instance of VardbVarWrapper

  • vardbs (list of strings) – list of vardbs

  • variable (string) – variable name to be read

  • value (int) – variable value to be waiting for

  • timeoutSec (int) – Seconds for waiting (default is 10)

  • dontCheckQ (bool) – if True, it will not raise exception in case of variable quality is NOK (0) (default is False)

Raises:

Exception – vardb variable FAILED in checkVarDoesNotChange. Expected(), Read().

glaciation.testing.generic.convertCompactRegToCsv(filePath, delete)[source]

Extract CompactReg file into csv

Parameters:
  • filePath (string) – Full file path of the CompactReg

  • delete (bool) – If true remove generated metadata and the original file

Raises:

Exception – Error cleaning compact file

Returns:

returnCode – return code of subprocess call

Return type:

int

glaciation.testing.generic.finishTestNotOK(errorMessage, programName)[source]

Print out something similar to mamut when test FAILS

Parameters:
  • errorMessage (string) – Error message

  • programName (string) – name of the test

glaciation.testing.generic.finishTestOk(programName)[source]

Print out something similar to mamut when test has PASSED OK

Parameters:

programName (string) – name of the test

glaciation.testing.generic.forceAliases(vdb, aliases, value)[source]

Force a variable from multiple vardbs

Parameters:
  • vdb (class VardbVarWrapper) – instance of VardbVarWrapper

  • aliases (list of functions) – list of aliases to be forced

  • value (int) – value to be forced

Raises:

Exception – Variable doesn’t exist in vardb.  Error forcing variable

glaciation.testing.generic.forceVars(vdb, vardbs, variable, value)[source]

Force a variable from multiple vardbs

Parameters:
  • vdb (class VardbVarWrapper) – instance of VardbVarWrapper

  • vardbs (list of strings) – list of vardbs

  • variable (string) – variable name to be forced

  • value (int) – value to be forced

Raises:

Exception – Variable doesn’t exist in vardb.  Error forcing variable

glaciation.testing.generic.initTest(programName, tester, log_file_path, description)[source]

Initialize logger and print out something similar to mamut output file.  programName, tester, log_file_path can be override calling the from console params (Ex. RQM).

Parameters:
  • programName (string) – name of the test (can be override with sys.argv[1])

  • tester (string) – name of the tester (can be override with sys.argv[2])

  • log_file_path (string (can be override with sys.argv[3])) – file path to write test logs

  • description (string) – description of the test

Returns:

  • programName (string) – name of the test (can be override with sys.argv[1])

  • tester (string) – name of the tester (can be override with sys.argv[2])

  • log_file_path (string (can be override with sys.argv[3])) – file path to write test logs

glaciation.testing.generic.readVars(vdb, vardbs, variable)[source]

Read a variable from multiple vardbs

Parameters:
  • vdb (class VardbVarWrapper) – instance of VardbVarWrapper

  • vardbs (list of strings) – list of vardbs

  • variable (string) – variable name to be read

Raises:

Exception – Variable doesn’t exist in vardb.  Error reading variable

Returns:

results – All vardb variable values

Return type:

array

glaciation.testing.generic.stepNOk(stepNumber, error='')[source]

Print out something similar to mamut when step has PASSED NOK

Parameters:
  • stepNumber (string) – number of the step

  • error (string) – error message to show (default is empty )

Raises:

Exception – TEST STEP NOK: ERROR

glaciation.testing.generic.stepOk(stepNumber)[source]

Print out something similar to mamut when step has PASSED OK

Parameters:

stepNumber (string) – number of the step

glaciation.testing.generic.unforceVars(vdb, vardbs, variable)[source]

Unforce a variable from multiple vardbs

Parameters:
  • vdb (class VardbVarWrapper) – instance of VardbVarWrapper

  • vardbs (list of strings) – list of vardbs

  • variable (string) – variable name to be unforced

Raises:

Exception – Variable doesn’t exist in vardb.  Error unforcing variable

glaciation.testing.generic.wait(wait, message='Sleeping...')[source]

Prints a countdown progress bar while sleeping

Parameters:
  • wait (int) – sleeping time in seconds

  • message (string) – Custom message to show (default is ‘Sleeping…’ )

glaciation.testing.generic.waitNotVar(vdb, vardbs, variable, value, timeoutSec=10, only1=False)[source]

Wait until variable/s have a value different from value.  Function will finish before timeout if all values are different from value.

Parameters:
  • vdb (class VardbVarWrapper) – instance of VardbVarWrapper

  • vardbs (list of strings) – list of vardbs

  • variable (string) – variable name to be read

  • value (int) – variable value to be waiting for

  • timeoutSec (int) – Function timeout. Senconds to raise exception (default is 10)

  • only1 (bool) – If true the function will exit ok if any vardb value if different from value (default is False)

Raises:

Exception – vardb variable FAILED in case variable == value in any vardb after timeoutSec seconds.

glaciation.testing.generic.waitVar(vdb, vardbs, variable, value, timeoutSec=10, dontCheckQ=False)[source]

Wait until variable/s have a specific value.  Function will finish before timeout if all values are Ok.

Parameters:
  • vdb (class VardbVarWrapper) – instance of VardbVarWrapper

  • vardbs (list of strings) – list of vardbs

  • variable (string) – variable name to be read

  • value (int) – variable value to be waiting for

  • timeoutSec (int) – Function timeout. Senconds to raise exception (default is 10)

Raises:

Exception – vardb variable FAILED in case variable != value in any vardb after timeoutSec seconds

Module contents