BasicTools.Helpers.Tests module

Testing infrastructure for BasicTools extra modules

BasicTools.Helpers.Tests.CheckIfAllThePresentFilesAreTested(extraToolsBoxes, testedFiles)[source]
BasicTools.Helpers.Tests.GetUniqueTempFile(suffix: str = '', prefix: str = 'tmp') Tuple[int, str][source]

Create a unique temporary file on the temp directory

  • suffix (str, optional) – If ‘suffix’ is not None, the file name will end with that suffix, otherwise there will be no suffix., by default “”

  • prefix (str, optional) – If ‘prefix’ is not None, the file name will begin with that prefix, otherwise a default prefix is used., by default ‘tmp’


please read the doc of module tempfile.mkstemp

Return type:


BasicTools.Helpers.Tests.RunListOfCheckIntegrities(toTest: List[Callable[[bool], str]], GUI: bool = False) str[source]
Execute all the functions in the list. Stop at the first error.

the functions must return “ok”, “skip” to be treated as successful function

  • toTest (List[Callable[[bool],str] ]) – a list of functions

  • GUI (bool, optional) – bool argument passed to every function , by default False


“ok” if all functions are executed correctly (the return of every function is “ok”) “error…” at the first error encountered

Return type:


BasicTools.Helpers.Tests.RunTests() int[source]

Base function to run all tests, all the option are captured from the command line arguments.


return the number of failed tests

Return type:


BasicTools.Helpers.Tests.SkipTest(environnementVariableName: str) bool[source]

chef if a environnement variable is present to help the user to skip test


environnementVariableName (str) – the name of a environnement variable


true if the variable is present false if absent

Return type:


BasicTools.Helpers.Tests.TestAll(modulesToTreat=['ALL'], modulesToSkip=[], fullOutput=False, stopAtFirstError=False, extraToolsBoxes=None, dryRun=False, profiling=False, coverage=None, typing=False)[source]
class BasicTools.Helpers.Tests.TestTempDir[source]

Bases: object

Class to generate and to destroy a temporary directory

classmethod DeleteTempPath()[source]
classmethod GetTempPath(onRam=None)[source]
classmethod OpenTempFolder()[source]
classmethod SetTempPath(path, create=True)[source]
createdOnRam = False
path = None
prefix = 'BasicTools_Test_Directory_'
BasicTools.Helpers.Tests.WriteTempFile(filename: str, content: str | None = None, mode: str = 'w') str[source]

Create and fill a temporary file on the temporary folder

  • filename (str) – the name of the file to be created

  • content (str, optional) – the content of the file, by default None

  • mode (str, optional) – read python “open” function documentation for more detail, by default “w”


the name of the filename (with the path attached)

Return type:



Exception – if error during the file creation