From 86154b6538c1fec69fde14f2d4b35c31dcc10b35 Mon Sep 17 00:00:00 2001 From: Jhon Honce Date: Tue, 10 Jul 2018 12:12:59 -0700 Subject: Refactor attach()/start() after podman changes * Update examples * Update/Clean up unittests * Add Mixins for container attach()/start() Signed-off-by: Jhon Honce Closes: #1080 Approved by: baude --- contrib/python/test/test_containers.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'contrib/python/test/test_containers.py') diff --git a/contrib/python/test/test_containers.py b/contrib/python/test/test_containers.py index 87d43adb4..ec2dcde03 100644 --- a/contrib/python/test/test_containers.py +++ b/contrib/python/test/test_containers.py @@ -72,14 +72,18 @@ class TestContainers(PodmanTestCase): mock_in.write('echo H"ello, World"; exit\n') mock_in.seek(0, 0) - self.alpine_ctnr.attach( - stdin=mock_in.fileno(), stdout=mock_out.fileno()) + ctnr = self.pclient.images.get(self.alpine_ctnr.image).container( + detach=True, tty=True) + ctnr.attach(stdin=mock_in.fileno(), stdout=mock_out.fileno()) + ctnr.start() mock_out.flush() mock_out.seek(0, 0) output = mock_out.read() self.assertIn('Hello', output) + ctnr.remove(force=True) + def test_processes(self): actual = list(self.alpine_ctnr.processes()) self.assertGreaterEqual(len(actual), 2) @@ -133,8 +137,7 @@ class TestContainers(PodmanTestCase): def test_commit(self): # TODO: Test for STOPSIGNAL when supported by OCI # TODO: Test for message when supported by OCI - details = self.pclient.images.get( - self.alpine_ctnr.inspect().image).inspect() + details = self.pclient.images.get(self.alpine_ctnr.image).inspect() changes = ['ENV=' + i for i in details.containerconfig['env']] changes.append('CMD=/usr/bin/zsh') changes.append('ENTRYPOINT=/bin/sh date') -- cgit v1.2.3-54-g00ecf