diff options
author | Michal Minar <miminar@redhat.com> | 2012-12-12 10:51:40 +0100 |
---|---|---|
committer | Michal Minar <miminar@redhat.com> | 2012-12-13 13:27:31 +0100 |
commit | 54e501a7225d30695bdcc2edb3b406986290e6e6 (patch) | |
tree | 905c4c0ac5a4c746e75c9006ca63013cd53c6864 /src/software/openlmi | |
parent | 51d608eb5db9d977750709fb9ad4a0fad2be6c02 (diff) | |
download | openlmi-providers-54e501a7225d30695bdcc2edb3b406986290e6e6.tar.gz openlmi-providers-54e501a7225d30695bdcc2edb3b406986290e6e6.tar.xz openlmi-providers-54e501a7225d30695bdcc2edb3b406986290e6e6.zip |
fixed test selection, when launching tests with run
particular tests can be selected like this:
* # runs all tests defined by this test case
./run.py -- TestSoftwarePackage
* # runs single test defined by TestSoftwarePackage TestCase
./run.py -- TestSoftwarePackage.test_get_instance
added comments for each assert
made results of tests a lot more readable
different file mode for symlinks passes like in rpm -V
increased number of packages for testing to 5
Diffstat (limited to 'src/software/openlmi')
-rw-r--r-- | src/software/openlmi/software/util/common.py | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/src/software/openlmi/software/util/common.py b/src/software/openlmi/software/util/common.py index a5b7c60..685171a 100644 --- a/src/software/openlmi/software/util/common.py +++ b/src/software/openlmi/software/util/common.py @@ -699,15 +699,22 @@ class SoftwareFileCheck: """ if not isinstance(file_check, SoftwareFileCheck.FileCheck): raise TypeError("file_check must be an instance of FileCheck") - return ( file_check.exists - and all( val[0] == val[1] - #pylint: disable=W0212 - for k, val in file_check._asdict().items() - if ( isinstance(val, tuple) - and ( k != "last_modification_time" - or file_check.file_type[0] == \ - SoftwareFileCheck.filetype_str2pywbem("file") - )))) + passed = file_check.exists + for k, val in file_check._asdict().items(): + if not passed: + break + if not isinstance(val, tuple): + continue + if ( k == "last_modification_time" + and file_check.file_type[0] != \ + SoftwareFileCheck.filetype_str2pywbem("file")): + continue + if ( k == "file_mode" + and file_check.file_type[0] == \ + SoftwareFileCheck.filetype_str2pywbem("symlink")): + continue + passed = val[0] == val[1] + return passed @staticmethod def _filecheck2model_flags(file_check): @@ -718,14 +725,21 @@ class SoftwareFileCheck: flags = [] for k, value in file_check._asdict().items(): #pylint: disable=W0212 if isinstance(value, tuple): - if ( k != "last_modification_time" - or file_check.file_type[0] == - SoftwareFileCheck.filetype_str2pywbem('file')): + if ( k == "last_modification_time" + and file_check.file_type[0] != \ + SoftwareFileCheck.filetype_str2pywbem('file')): # last_modification_time check is valid only for # regular files - flag = file_check.exists and value[0] == value[1] + flag = file_check.exists + elif ( k == "file_mode" + and file_check.file_type[0] == \ + SoftwareFileCheck.filetype_str2pywbem('symlink')): + # do not check mode of symlinks + flag = ( file_check.exists + and ( file_check.file_type[0] + == file_check.file_type[1])) else: - flag = True + flag = file_check.exists and value[0] == value[1] flags.append(flag) elif isinstance(value, bool): flags.append(value) |