Skip to content
Snippets Groups Projects
Commit ad1b4703 authored by Stefano Borini's avatar Stefano Borini
Browse files

py27 compat

parent 481ce0b8
No related branches found
No related tags found
1 merge request!108Introduced log file option
......@@ -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__':
......
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."):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment