Add support for testtools 2.8.x
Signed-off-by: Stephen Finucane <stephenfin@redhat.com> Change-Id: I2a8ed7c1c2dfe8837b493f29a6032b7f2c036a0e
This commit is contained in:
@@ -51,6 +51,8 @@ unknown_cmd: CommandFilter, /unknown/unknown_cmd, root
|
||||
later_install_cmd: CommandFilter, {self.later_cmd}, root
|
||||
""")
|
||||
|
||||
def execute(self, cmd, stdin=None): ...
|
||||
|
||||
def _test_run_once(self, expect_byte: bool = True) -> None:
|
||||
code, out, err = self.execute(['echo', 'teststr'])
|
||||
self.assertEqual(0, code)
|
||||
@@ -97,7 +99,7 @@ later_install_cmd: CommandFilter, {self.later_cmd}, root
|
||||
|
||||
def test_run_as(self):
|
||||
if os.getuid() != 0:
|
||||
self.skip('Test requires root (for setuid)')
|
||||
self.skipTest('Test requires root (for setuid)')
|
||||
|
||||
# Should run as 'nobody'
|
||||
code, out, err = self.execute(['id', '-u'])
|
||||
|
||||
@@ -31,6 +31,7 @@ except ImportError:
|
||||
|
||||
import fixtures
|
||||
from testtools import content
|
||||
from testtools import content_type
|
||||
|
||||
from oslo_rootwrap import client
|
||||
from oslo_rootwrap import cmd
|
||||
@@ -111,13 +112,13 @@ class RootwrapDaemonTest(functional_base._FunctionalBase):
|
||||
self.addDetail(
|
||||
'daemon_log',
|
||||
content.Content(
|
||||
content.UTF8_TEXT, lambda: [daemon_log.getvalue()]
|
||||
content_type.UTF8_TEXT, lambda: [daemon_log.getvalue()]
|
||||
),
|
||||
)
|
||||
self.addDetail(
|
||||
'client_log',
|
||||
content.Content(
|
||||
content.UTF8_TEXT,
|
||||
content_type.UTF8_TEXT,
|
||||
lambda: [client_log.getvalue().encode('utf-8')],
|
||||
),
|
||||
)
|
||||
@@ -134,7 +135,8 @@ class RootwrapDaemonTest(functional_base._FunctionalBase):
|
||||
assert self.client._finalize is not None # narrow type
|
||||
self.client._finalize()
|
||||
|
||||
self.execute = self.client.execute
|
||||
def execute(self, cmd, stdin=None):
|
||||
return self.client.execute(cmd, stdin=stdin)
|
||||
|
||||
def test_run_once(self):
|
||||
self._test_run_once(expect_byte=False)
|
||||
|
||||
Reference in New Issue
Block a user