diff options
author | Michal Minar <miminar@redhat.com> | 2013-10-23 07:56:01 +0200 |
---|---|---|
committer | Michal Minar <miminar@redhat.com> | 2013-10-24 10:28:30 +0200 |
commit | 2229fa7f328b9e8b49266eb69150ab4be18ba354 (patch) | |
tree | d1050732d5e283eddd1bf51942a7cc73be1467ac /src/software | |
parent | fe9ffdf9ab8be28357c256a3f1052832304b241b (diff) | |
download | openlmi-providers-2229fa7f328b9e8b49266eb69150ab4be18ba354.tar.gz openlmi-providers-2229fa7f328b9e8b49266eb69150ab4be18ba354.tar.xz openlmi-providers-2229fa7f328b9e8b49266eb69150ab4be18ba354.zip |
minor test improvements
Diffstat (limited to 'src/software')
l--------- | src/software/providers | 1 | ||||
-rw-r--r-- | src/software/test/README | 31 | ||||
-rw-r--r-- | src/software/test/package.py | 1 | ||||
-rw-r--r-- | src/software/test/rpmcache.py | 2 | ||||
-rwxr-xr-x | src/software/test/run.py | 5 | ||||
-rw-r--r--[-rwxr-xr-x] | src/software/test/test_hosted_software_collection.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | src/software/test/test_hosted_software_identity_resource.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | src/software/test/test_installed_software_identity.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | src/software/test/test_member_of_software_collection.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | src/software/test/test_resource_for_software_identity.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | src/software/test/test_software_identity.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | src/software/test/test_software_identity_checks.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | src/software/test/test_software_identity_file_check.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | src/software/test/test_software_identity_resource.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | src/software/test/test_system_software_collection.py | 0 |
15 files changed, 26 insertions, 14 deletions
diff --git a/src/software/providers b/src/software/providers deleted file mode 120000 index da87cf3..0000000 --- a/src/software/providers +++ /dev/null @@ -1 +0,0 @@ -lmi/software
\ No newline at end of file diff --git a/src/software/test/README b/src/software/test/README index e2b3cc6..cb1acce 100644 --- a/src/software/test/README +++ b/src/software/test/README @@ -1,3 +1,5 @@ +Testing +======= Tests must be run as root on machine with cimom broker. There are number of environment variables, that affect test running: LMI_CIMOM_USERNAME @@ -14,13 +16,24 @@ There are number of environment variables, that affect test running: directory will be created and deleted, when tests are complete -Simple usage: - Each test module can be run as a stand-alone script or with run.py - script: - $ ./run.py -c --cache-dir=/var/tmp - To pass any arguments to underlying unittest.main() function, append them - after "--" swith like this: - $ ./run.py -c --cache-dir=/var/tmp -- -v TestSoftwarePackage - All environment variables defined above can be overriden by command-line - arguments. +Preparation +----------- +Tests are installed together with source in single python egg. They are +accessible from ``lmi.test.software`` package. + +Running tests +------------- +They can be run with a script ``lmi-test-software``. + +Each test module can be run as a stand-alone script or with run.py script: :: + + ./run.py -c --cache-dir=/var/tmp + +To pass any arguments to underlying ``unittest.main()`` function, append them +after "--" swith like this: :: + + ./run.py -c --cache-dir=/var/tmp -- -v TestSoftwarePackage + +All environment variables defined above can be overriden by command-line +arguments. diff --git a/src/software/test/package.py b/src/software/test/package.py index 9f54a8d..d7b2288 100644 --- a/src/software/test/package.py +++ b/src/software/test/package.py @@ -22,6 +22,7 @@ Abstraction for RPM package for test purposes. """ import json + import util class Package(object): #pylint: disable=R0902 diff --git a/src/software/test/rpmcache.py b/src/software/test/rpmcache.py index 10c4e2b..c6205d2 100644 --- a/src/software/test/rpmcache.py +++ b/src/software/test/rpmcache.py @@ -31,8 +31,8 @@ import re from collections import defaultdict from subprocess import call, check_output, CalledProcessError -from package import Package, PackageEncoder, from_json import util +from package import Package, PackageEncoder, from_json DB_BACKUP_FILE = 'lmi_software_test_cache' diff --git a/src/software/test/run.py b/src/software/test/run.py index 74c2cf3..8b9999c 100755 --- a/src/software/test/run.py +++ b/src/software/test/run.py @@ -230,7 +230,7 @@ class LMITestLoader(unittest.TestLoader): Override of parent method to make test cases accessible to by their names from command line. """ - suite = load_tests(self, None, None) + suite = load_tests(self, None, 'test_*') parts = name.split('.') node = suite for part in parts: @@ -291,7 +291,7 @@ def main(): cache_dir=CACHE_DIR, repolist=repolist) prepare_environment(args) - test_program = unittest.main(argv=ut_args, + test_program = unittest.main(__name__, argv=ut_args, testLoader=LMITestLoader(), exit=False) if args.use_cache and not args.cache_dir: shutil.rmtree(CACHE_DIR) @@ -299,4 +299,3 @@ def main(): if __name__ == '__main__': main() - diff --git a/src/software/test/test_hosted_software_collection.py b/src/software/test/test_hosted_software_collection.py index 6f4adc3..6f4adc3 100755..100644 --- a/src/software/test/test_hosted_software_collection.py +++ b/src/software/test/test_hosted_software_collection.py diff --git a/src/software/test/test_hosted_software_identity_resource.py b/src/software/test/test_hosted_software_identity_resource.py index df4b11f..df4b11f 100755..100644 --- a/src/software/test/test_hosted_software_identity_resource.py +++ b/src/software/test/test_hosted_software_identity_resource.py diff --git a/src/software/test/test_installed_software_identity.py b/src/software/test/test_installed_software_identity.py index 31bbd1c..31bbd1c 100755..100644 --- a/src/software/test/test_installed_software_identity.py +++ b/src/software/test/test_installed_software_identity.py diff --git a/src/software/test/test_member_of_software_collection.py b/src/software/test/test_member_of_software_collection.py index 207937c..207937c 100755..100644 --- a/src/software/test/test_member_of_software_collection.py +++ b/src/software/test/test_member_of_software_collection.py diff --git a/src/software/test/test_resource_for_software_identity.py b/src/software/test/test_resource_for_software_identity.py index 39bbfb2..39bbfb2 100755..100644 --- a/src/software/test/test_resource_for_software_identity.py +++ b/src/software/test/test_resource_for_software_identity.py diff --git a/src/software/test/test_software_identity.py b/src/software/test/test_software_identity.py index ea60afe..ea60afe 100755..100644 --- a/src/software/test/test_software_identity.py +++ b/src/software/test/test_software_identity.py diff --git a/src/software/test/test_software_identity_checks.py b/src/software/test/test_software_identity_checks.py index e7d364b..e7d364b 100755..100644 --- a/src/software/test/test_software_identity_checks.py +++ b/src/software/test/test_software_identity_checks.py diff --git a/src/software/test/test_software_identity_file_check.py b/src/software/test/test_software_identity_file_check.py index 96e086d..96e086d 100755..100644 --- a/src/software/test/test_software_identity_file_check.py +++ b/src/software/test/test_software_identity_file_check.py diff --git a/src/software/test/test_software_identity_resource.py b/src/software/test/test_software_identity_resource.py index d321523..d321523 100755..100644 --- a/src/software/test/test_software_identity_resource.py +++ b/src/software/test/test_software_identity_resource.py diff --git a/src/software/test/test_system_software_collection.py b/src/software/test/test_system_software_collection.py index bf33c56..bf33c56 100755..100644 --- a/src/software/test/test_system_software_collection.py +++ b/src/software/test/test_system_software_collection.py |