diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..2671a63 --- /dev/null +++ b/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=review.openstack.org +port=29418 +project=stackforge/murano-conductor.git diff --git a/tests/conductor/test_heat_commands.py b/tests/conductor/test_heat_commands.py index 9e4777f..58a2b81 100644 --- a/tests/conductor/test_heat_commands.py +++ b/tests/conductor/test_heat_commands.py @@ -24,7 +24,6 @@ from conductor.commands.cloud_formation import HeatExecutor class TestHeatExecutor(unittest.TestCase): - def setUp(self): self.mfs = mockfs.replace_builtins() template = { @@ -48,8 +47,6 @@ class TestHeatExecutor(unittest.TestCase): 'endpoints': [{'publicURL': 'http://invalid.heat.url'}] }] - - @mock.patch('heatclient.v1.client.Client') @mock.patch('keystoneclient.v2_0.client.Client') @mock.patch('conductor.config.CONF') @@ -70,7 +67,6 @@ class TestHeatExecutor(unittest.TestCase): 'arg2': 'arg2Value'}, callback=callback) - heat_mock().stacks.get().stack_status = 'CREATE_COMPLETE' heat_mock().stacks.template = mock.MagicMock( side_effect=heatclient.exc.HTTPNotFound) @@ -125,9 +121,7 @@ class TestHeatExecutor(unittest.TestCase): get_mock._status_index += 1 return get_mock - heat_mock().stacks.get = mock.MagicMock(side_effect=side_effect) - heat_mock().stacks.template = mock.MagicMock( return_value={'instance': {}}) @@ -160,7 +154,6 @@ class TestHeatExecutor(unittest.TestCase): command='Delete', callback=callback) - heat_mock().stacks.get = mock.MagicMock( side_effect=heatclient.exc.HTTPNotFound) diff --git a/tests/conductor/test_methods.py b/tests/conductor/test_methods.py index 68c4ede..55c790f 100644 --- a/tests/conductor/test_methods.py +++ b/tests/conductor/test_methods.py @@ -19,8 +19,8 @@ import conductor.rabbitmq as rabbitmq from conductor.workflow import Workflow import conductor.xml_code_engine as engine -class TestMethodsAndClasses(unittest.TestCase): +class TestMethodsAndClasses(unittest.TestCase): def test_init_service_class(self): con = ConductorWorkflowService() diff --git a/tests/conductor/test_with_fake_service.py b/tests/conductor/test_with_fake_service.py index ca380b1..3026592 100644 --- a/tests/conductor/test_with_fake_service.py +++ b/tests/conductor/test_with_fake_service.py @@ -17,10 +17,9 @@ import unittest from conductor.app import ConductorWorkflowService from conductor.openstack.common import service -class TestMethodsAndClasses(unittest.TestCase): +class TestMethodsAndClasses(unittest.TestCase): def test_init_service_class(self): launcher = service.ServiceLauncher() con = ConductorWorkflowService() launcher.launch_service(con) - diff --git a/tests/conductor/test_workflow.py b/tests/conductor/test_workflow.py index fec8557..92a9e84 100644 --- a/tests/conductor/test_workflow.py +++ b/tests/conductor/test_workflow.py @@ -51,7 +51,7 @@ class TestWorkflow(unittest.TestCase): def test_empty_workflow_leaves_object_model_unchanged(self): xml = '' self._execute_workflow(xml) - self.assertIsNone(deep.diff(self.original_model, self.model)) + self.assertTrue(deep.diff(self.original_model, self.model) is None) def test_modifying_object_model_from_workflow(self): xml = ''' @@ -63,8 +63,8 @@ class TestWorkflow(unittest.TestCase): ''' - self.assertNotIn( - 'state', + self.assertFalse( + 'state' in self.model['services']['activeDirectories'][0]) self._execute_workflow(xml) @@ -73,9 +73,9 @@ class TestWorkflow(unittest.TestCase): self.model['services']['activeDirectories'][0]['state']['invalid'], 'value') - self.assertIsNotNone(deep.diff(self.original_model, self.model)) + self.assertFalse(deep.diff(self.original_model, self.model) is None) del self.model['services']['activeDirectories'][0]['state'] - self.assertIsNone(deep.diff(self.original_model, self.model)) + self.assertTrue(deep.diff(self.original_model, self.model) is None) def test_selecting_properties_from_object_model_within_workflow(self): xml = ''' @@ -96,4 +96,3 @@ class TestWorkflow(unittest.TestCase): self.assertEqual( self.model['services']['activeDirectories'][0]['test'], 'Domain acme.loc with primary DC dc01') - diff --git a/tox.ini b/tox.ini index 9033100..959459c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27,pep8 +envlist = py26,py27,pep8,pyflakes [testenv] setenv = VIRTUAL_ENV={envdir} @@ -44,3 +44,15 @@ commands = nosetests --cover-erase --cover-package=conductor --with-xcoverage deps = file://{toxinidir}/.cache.bundle setenv = NOSE_WITH_XUNIT=1 commands = {posargs} + +[testenv:pyflakes] +deps = flake8 +commands = flake8 + +[flake8] +# H301 one import per line +# H302 import only modules +ignore = H301,H302,F401 +show-source = true +builtins = _ +exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools \ No newline at end of file