diff --git a/force_bdss/cli/tests/test_execution.py b/force_bdss/cli/tests/test_execution.py index 50cf18014cd566bbfd97a97e559a495f603caff5..d427e154134ef6e55f1688dbf09a08d89e2f5808 100644 --- a/force_bdss/cli/tests/test_execution.py +++ b/force_bdss/cli/tests/test_execution.py @@ -3,6 +3,8 @@ import subprocess import os from contextlib import contextmanager +import six + from force_bdss.tests import fixtures @@ -43,16 +45,16 @@ class TestExecution(unittest.TestCase): with self.assertRaises(subprocess.CalledProcessError): subprocess.check_call( ["force_bdss", "test_csv_v2.json"], - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL) + stdout=os.devnull, + stderr=os.devnull) def test_corrupted_file_input(self): with cd(fixtures.dirpath()): with self.assertRaises(subprocess.CalledProcessError): subprocess.check_call( ["force_bdss", "test_csv_corrupted.json"], - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL) + stdout=os.devnull, + stderr=os.devnull) if __name__ == '__main__': diff --git a/force_bdss/tests/test_core_evaluation_driver.py b/force_bdss/tests/test_core_evaluation_driver.py index 141c8a3f5d6e2f1eca92c472cb77bd9ed4b0c39b..a6084e73294e123a6570e3a2086b08cdb948729d 100644 --- a/force_bdss/tests/test_core_evaluation_driver.py +++ b/force_bdss/tests/test_core_evaluation_driver.py @@ -1,6 +1,7 @@ import unittest import testfixtures +import six from force_bdss.tests.probe_classes.factory_registry_plugin import \ ProbeFactoryRegistryPlugin @@ -49,7 +50,8 @@ class TestCoreEvaluationDriver(unittest.TestCase): driver = CoreEvaluationDriver( application=self.mock_application) with testfixtures.LogCapture(): - with self.assertRaisesRegex( + with six.assertRaisesRegex( + self, RuntimeError, "The number of data values returned by the MCO"): driver.application_started() @@ -66,7 +68,8 @@ class TestCoreEvaluationDriver(unittest.TestCase): driver = CoreEvaluationDriver( application=self.mock_application) with testfixtures.LogCapture(): - with self.assertRaisesRegex( + with six.assertRaisesRegex( + self, RuntimeError, "The number of data values \(1 values\)" " returned by 'test_data_source' does not match" @@ -87,7 +90,8 @@ class TestCoreEvaluationDriver(unittest.TestCase): application=self.mock_application, ) with testfixtures.LogCapture(): - with self.assertRaisesRegex( + with six.assertRaisesRegex( + self, RuntimeError, "The number of data values \(1 values\)" " returned by 'test_data_source' does not match" @@ -107,7 +111,8 @@ class TestCoreEvaluationDriver(unittest.TestCase): application=self.mock_application, ) with testfixtures.LogCapture(): - with self.assertRaisesRegex( + with six.assertRaisesRegex( + self, RuntimeError, "The number of data values \(1 values\)" " returned by 'test_kpi_calculator' does not match" @@ -130,7 +135,8 @@ class TestCoreEvaluationDriver(unittest.TestCase): ) with testfixtures.LogCapture(): - with self.assertRaisesRegex( + with six.assertRaisesRegex( + self, RuntimeError, "The number of data values \(1 values\)" " returned by 'test_kpi_calculator' does not match" @@ -164,7 +170,8 @@ class TestCoreEvaluationDriver(unittest.TestCase): ) with testfixtures.LogCapture(): - with self.assertRaisesRegex( + with six.assertRaisesRegex( + self, RuntimeError, "The length of the slots is not equal to the length of" " the slot map"): @@ -177,7 +184,8 @@ class TestCoreEvaluationDriver(unittest.TestCase): ) with testfixtures.LogCapture(): - with self.assertRaisesRegex( + with six.assertRaisesRegex( + self, RuntimeError, "Unable to find requested name 'blap' in available" " data values."):