diff options
author | lmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4> | 2011-06-16 21:46:22 +0000 |
---|---|---|
committer | lmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4> | 2011-06-16 21:46:22 +0000 |
commit | 3de1c1e1ac8375ab553a6cb98d22362a0c4c48ac (patch) | |
tree | 2b0c37ea23ec8bfca64d6aca8090e6d5029e250a | |
parent | c363a510b5a7113f5533dc80c960f5c7b4f1e0fc (diff) |
client/common_lib/logging_manager_test.py: Fix unittest for py >= 2.6
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 <lmr@redhat.com>
git-svn-id: svn://test.kernel.org/autotest/trunk@5430 592f7852-d20e-0410-864c-8624ca9c26a4
-rwxr-xr-x | 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 bef391f2..5c0e82fd 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): |