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

test: fix test py2 compatibility

parent 0fad9a6d
Pipeline #36935 failed with stage
in 0 seconds
from unittest.mock import MagicMock
import unittest
from slapos.recipe import switch_softwaretype
import zc.buildout.testing
from zc.buildout.buildout import MissingOption, MissingSection
from mock import MagicMock
import six
class SwitchSoftwaretypeTest(unittest.TestCase):
......@@ -55,8 +57,11 @@ class SwitchSoftwaretypeTest(unittest.TestCase):
def test_fallback_default(self):
self.buildout['slap-configuration']['slap-software-type'] = 'RootSoftwareInstance'
with self.assertLogs('switch-softwaretype', level='INFO') as lc:
if six.PY2: # BBB
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.assertIn("The software_type 'RootSoftwareInstance' is deprecated", lc.output[0])
self.assertIn('instance-default.cfg', self.magick_sub_buildout.call_args.args)
  • @tomo I'm pushing this a bit later unless you have see a better of doing (this seems good enough for python2)

  • ah thanks. Yes it seems OK to test a bit less in python2.

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