The logging manager unittest relies on some internals of the python
unittest implementation. On py >= 2.6, the actual test method is called
in the file case.py, rather than unittest.py, which is the appropriate
file in python 2.4. So let's take both into account.

Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
---
 client/common_lib/logging_manager_test.py |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/client/common_lib/logging_manager_test.py 
b/client/common_lib/logging_manager_test.py
index bef391f..5c0e82f 100755
--- a/client/common_lib/logging_manager_test.py
+++ b/client/common_lib/logging_manager_test.py
@@ -258,8 +258,8 @@ class MonkeyPatchTestCase(unittest.TestCase):
 
     def check_filename(self, filename, expected=None):
         if expected is None:
-            expected = self.expected_filename
-        self.assertEquals(expected, os.path.split(filename)[1])
+            expected = [self.expected_filename]
+        self.assertIn(os.path.split(filename)[1], expected)
 
 
     def _0_test_find_caller(self):
@@ -280,7 +280,9 @@ class MonkeyPatchTestCase(unittest.TestCase):
     def _0_test_non_reported_find_caller(self):
         finder = logging_manager._logging_manager_aware_logger__find_caller
         filename, lineno, caller_name = finder(logging_manager.logger)
-        self.check_filename(filename, expected='unittest.py')
+        # Python 2.4 unittest implementation will call the unittest method in
+        # file 'unittest.py', and Python >= 2.6 does the same in 'case.py'
+        self.check_filename(filename, expected=['unittest.py', 'case.py'])
 
 
     def _1_test_non_reported_find_caller(self):
-- 
1.7.5.4

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to