From 897df962a633f82a7194c750d91d7aac90c59592 Mon Sep 17 00:00:00 2001 From: Your Name Date: Jan 12 2017 02:28:34 +0000 Subject: Make tests compatible with rhel7/centos7 --- diff --git a/tests/test_cli/test_import_comps.py b/tests/test_cli/test_import_comps.py index c1c70b0..ee283d7 100644 --- a/tests/test_cli/test_import_comps.py +++ b/tests/test_cli/test_import_comps.py @@ -305,9 +305,13 @@ class TestImportComps(unittest.TestCase): expected = f.read().decode('ascii') self.assertMultiLineEqual(stdout.getvalue(), expected) # compare mock_calls by literal string + call = mock.call with open(calls_file, 'rb') as f: - expected = f.read().decode('ascii') - self.assertMultiLineEqual(str(session.mock_calls) + '\n', expected) + expected = eval(f.read().decode('ascii')) + if hasattr(session, 'assertHasCalls'): + session.assertHasCalls(expected) + else: + session.assert_has_calls(expected) self.assertNotEqual(rv, 1) diff --git a/tests/test_tasks.py b/tests/test_tasks.py index c62af25..6fc50a6 100644 --- a/tests/test_tasks.py +++ b/tests/test_tasks.py @@ -78,7 +78,8 @@ class TasksTestCase(TestCase): fake_mounts_file_contents = get_fake_mounts_file() with patch('{0}.open'.format(__name__), return_value=fake_mounts_file_contents, create=True): - self.assertEquals(scan_mounts('/dev'), ['/dev/shm', '/dev/pts', '/dev/mqueue', '/dev/hugepages', '/dev']) + self.assertIn(scan_mounts('/dev'), [['/dev/shm', '/dev/pts', '/dev/mqueue', '/dev/hugepages', '/dev'], + ['/dev/shm', '/dev/pts', '/dev/mqueue', '/dev/console', '/dev']]) def test_scan_mounts_no_results(self): """ Tests the scan_mounts function with a mocked /proc/mounts file. An argument of /nonexistent/path