Commit 6316e7bb authored by Jérome Perrin's avatar Jérome Perrin

test: fix test py2 compatibility

parent 0fad9a6d
from unittest.mock import MagicMock
import unittest import unittest
from slapos.recipe import switch_softwaretype from slapos.recipe import switch_softwaretype
import zc.buildout.testing import zc.buildout.testing
from zc.buildout.buildout import MissingOption, MissingSection from zc.buildout.buildout import MissingOption, MissingSection
from mock import MagicMock
import six
class SwitchSoftwaretypeTest(unittest.TestCase): class SwitchSoftwaretypeTest(unittest.TestCase):
...@@ -55,8 +57,11 @@ class SwitchSoftwaretypeTest(unittest.TestCase): ...@@ -55,8 +57,11 @@ class SwitchSoftwaretypeTest(unittest.TestCase):
def test_fallback_default(self): def test_fallback_default(self):
self.buildout['slap-configuration']['slap-software-type'] = 'RootSoftwareInstance' self.buildout['slap-configuration']['slap-software-type'] = 'RootSoftwareInstance'
with self.assertLogs('switch-softwaretype', level='INFO') as lc: if six.PY2: # BBB
self.install_recipe() self.install_recipe()
else:
with self.assertLogs('switch-softwaretype', level='INFO') as lc:
self.install_recipe()
self.assertIn("The software_type 'RootSoftwareInstance' is deprecated", lc.output[0])
self.magick_sub_buildout.assert_called_once() self.magick_sub_buildout.assert_called_once()
self.assertIn("The software_type 'RootSoftwareInstance' is deprecated", lc.output[0])
self.assertIn('instance-default.cfg', self.magick_sub_buildout.call_args.args) self.assertIn('instance-default.cfg', self.magick_sub_buildout.call_args.args)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment