mylinux.libs package¶
Submodules¶
mylinux.libs.AppErr module¶
Here are defined all possible application type errors. They are defined to show more info to the user/developer, and to catch errors that hides from developers.
-
exception
mylinux.libs.AppErr.
model
(message)[source]¶ Bases:
exceptions.Exception
Exception type for model error.
Parameters: message (str) – Message for error info.
Variables: - message (str) – Message for error info.
- exitCode (int) – Exit code.
mylinux.libs.Assert module¶
Warning
Every unit test module should have Assert.coverage
test in setUp class!
-
class
mylinux.libs.Assert.
Assert
[source]¶ Bases:
unittest.case.TestCase
Hellper class for adding functionality to unittesting.
Variables: maxDiff (boo) – You want to see max diff of error? -
classmethod
getErrorMessage
(err, replaceChar="'", newChar='')[source]¶ Getting error message base on python version.
Parameters: - err (cls) – Error class.
- replaceChar (str) – Replace which string in error msg.
- newChar (str) – Put new string in error msg.
Returns: Error message string.
-
coverage
(testClass, testClassSkiped, typeRemove, typeElements, typeSkiped)[source]¶ Custom coverage testing for testing class.
Parameters: - testClass (cls) – Test coverage for testing class.
- testClassSkiped (arr-str) – What methods don’t have testing logic?
- typeElements (arr-cls) – What class/instance is testClass testing?
- typeRemove (arr-str) – Remove strings from typeElements example: ‘_Controller’.
- typeSkiped (arr-str) – What methods testClass don’t want to test?
Raises: ValueError
– If typeElements is empty.ValueError
– If testClass don’t containes test_ string.ValueError
– If test are missing in testClass.
-
classmethod
mylinux.libs.decorator module¶
Here are defined all custom decorators.
-
mylinux.libs.decorator.
overrides
(interface_class)[source]¶ Decorator to override class method
Parameters: interface_class (cls) – Which class is being overrided? Raises: ValueError
– If method is not located in interface_class.Returns: Method that is overriding interface_class.
mylinux.libs.e2eData module¶
-
class
mylinux.libs.e2eData.
E2E_data
[source]¶ Hellper class for integration tests.
This class will simulate mylinux data structure for the executing tests.
Variables: - filesPath (str) – Path where temporary tests will be located.
- packagesPath (str) – Relative path in fielsPath to package location.
- scriptsPath (str) – Relative path -//-
- installedPath (str) – Relative path -//-
Example of usage:
E2E_data.setUp( installed={ u'package': { u'configState': u'error', u'created': u'%d-%d-%d %d:%d:%d.%d', ... }, ... }, packages={ 'package': { 'info': {'class': 'class', ... }, 'scripts': { 'config-purge': 'printf CP...', 'config-install': 'printf CI...', ... } }, ... } ) E2E-test-data.tearDown()
-
filesPath
= 'E2E-test-data'¶
-
packagesPath
= 'E2E-test-data/packages'¶
-
scriptsPath
= 'E2E-test-data/scripts'¶
-
installedPath
= 'E2E-test-data/installed.json'¶
-
classmethod
setUp
(installed={}, scripts={}, packages={})[source]¶ Setup testing file structure.
Parameters: - installed (dic) – Dictionary if installed data.
- scripts (dic) – All main scripts names and data.
- packages (dic) – List package names and his structures.
Raises: ValueError
– If testing structure already exist.
-
classmethod
getData
()[source]¶ Get all data info from filesPath.
Returns: Dictionary of all files in files structure. Example of returning data:
{ '<ROOT>/installed.json': { u'package': { u'configState': u'None', u'created': u'%d-%d-%d %d:%d:%d.%d', u'lastChange': u'%d-%d-%d %d:%d:%d.%d', u'packageState': u'None'}, } }, '<ROOT>/packages/package/info.json': { u'class': u'class', u'info': u'info', u'module': u'module' }, '<ROOT>/packages/package/scripts/config-install': ['printf CI...'], '<ROOT>/packages/package/scripts/config-purge': ['printf CP...'], '<ROOT>/packages/package/scripts/package-install': ['printf PI...'], '<ROOT>/packages/package/scripts/package-purge': ['printf PP...'], '<ROOT>/packages/package/scripts/test.py': ['printf T...'] }
Module contents¶
Other Parameters: | |
---|---|
|