]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/utils: fix testcase decorator to allow calling tests individually
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Tue, 23 Dec 2014 14:47:45 +0000 (14:47 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 25 Dec 2014 08:26:01 +0000 (08:26 +0000)
Without this, running tests individually failed with a traceback:

$ oe-selftest --run-test
buildoptions.ImageOptionsTests.test_incremental_image_generation
2014-12-23 14:40:37,636 - selftest - INFO - Checking that everything is in order before running the tests
2014-12-23 14:40:38,408 - selftest - INFO - Running bitbake -p
2014-12-23 14:40:40,235 - selftest - INFO - Loading tests from:
oeqa.selftest.buildoptions.ImageOptionsTests.test_incremental_image_generation
Traceback (most recent call last):
  File "/home/user/poky/scripts/oe-selftest", line 179, in <module>
    ret = main()
  File "/home/user/poky/scripts/oe-selftest", line 164, in main
    suite.addTests(loader.loadTestsFromName(test))
  File "/usr/lib64/python2.7/unittest/loader.py", line 91, in loadTestsFromName
    module = __import__('.'.join(parts_copy))
  File "/home/user/poky/meta/lib/oeqa/selftest/buildoptions.py", line 12, in <module>
    class ImageOptionsTests(oeSelfTest):
  File "/home/user/poky/meta/lib/oeqa/selftest/buildoptions.py", line 14, in ImageOptionsTests
    @testcase(761)
NameError: global name 'func' is not defined

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
meta/lib/oeqa/utils/decorators.py

index 1ae1162e33bf854f85bf36cdbb239080a5bcb9bc..2d5db2474a273f6ff15ab4f259e4ab8229bebad1 100644 (file)
@@ -89,6 +89,7 @@ class testcase(object):
         def wrapped_f(*args):
             return func(*args)
         wrapped_f.test_case = self.test_case
+        wrapped_f.__name__ = func.__name__
         return wrapped_f
 
 class NoParsingFilter(logging.Filter):