[Piglit] [PATCH 11/42] dmesg_tests.py: split large complex generator
Dylan Baker
baker.dylan.c at gmail.com
Wed Apr 22 15:10:00 PDT 2015
This generator shared a little bit of setup logic and the same loop, but
replaced most of the data multiple times.
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
framework/tests/dmesg_tests.py | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/framework/tests/dmesg_tests.py b/framework/tests/dmesg_tests.py
index 105ad2d..c264acb 100644
--- a/framework/tests/dmesg_tests.py
+++ b/framework/tests/dmesg_tests.py
@@ -271,6 +271,20 @@ def test_update_result_replace():
"dmesg.Dmesg.update_result: subtest '{0}' replaced correctly".format(res)
yield check_update_result, new_result['subtest']['test'], res
+
+ at utils.nose_generator
+def test_update_result_no_match_regex():
+ """ Generates tests for update_result """
+
+ def create_test_result(res):
+ result = framework.results.TestResult()
+ result['result'] = res
+ result['subtest'] = {}
+ result['subtest']['test'] = res
+ return result
+
+ dmesg = TestDmesg()
+ for res in ['pass', 'fail', 'crash', 'warn', 'skip', 'notrun']:
# check that the status is not updated when Dmesg.regex is set and does
# not match the dmesg output
dmesg.regex = re.compile("(?!)")
@@ -281,6 +295,20 @@ def test_update_result_replace():
"dmesg.Dmesg.update_result: with non-matching regex '{0}'".format(res)
yield check_equal_result, new_result['result'], res
+
+ at utils.nose_generator
+def test_update_result_match_regex():
+ """ Generates tests for update_result """
+
+ def create_test_result(res):
+ result = framework.results.TestResult()
+ result['result'] = res
+ result['subtest'] = {}
+ result['subtest']['test'] = res
+ return result
+
+ dmesg = TestDmesg()
+ for res in ['pass', 'fail', 'crash', 'warn', 'skip', 'notrun']:
# check that the status is updated when Dmesg.regex is set and matches
# the dmesg output
dmesg.regex = re.compile("piglit.*test")
--
2.3.5
More information about the Piglit
mailing list