Skip to content

Commit

Permalink
⚡ basic test for ipc for high coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
sachinkum0009 committed Sep 2, 2024
1 parent b23bf60 commit 5aad3d8
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/test_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,40 @@ def test_home_extension(self):
args = p.get_docker_args(mock_cliargs)
self.assertTrue('-v %s:%s' % (Path.home(), Path.home()) in args)


class IpcExtensionTest(unittest.TestCase):

def setUp(self):
# Work around interference between empy Interpreter
# stdout proxy and test runner. empy installs a proxy on stdout
# to be able to capture the information.
# And the test runner creates a new stdout object for each test.
# This breaks empy as it assumes that the proxy has persistent
# between instances of the Interpreter class
# empy will error with the exception
# "em.Error: interpreter stdout proxy lost"
em.Interpreter._wasProxyInstalled = False

@pytest.mark.docker
def test_ipc_extension(self):
plugins = list_plugins()
ipc_plugin = plugins['ipc']
self.assertEqual(ipc_plugin.get_name(), 'ipc')

p = ipc_plugin()
self.assertTrue(plugin_load_parser_correctly(ipc_plugin))

mock_cliargs = {'ipc': 'none'}
self.assertEqual(p.get_snippet(mock_cliargs), '')
self.assertEqual(p.get_preamble(mock_cliargs), '')
args = p.get_docker_args(mock_cliargs)
self.assertTrue('--ipc none' in args)

mock_cliargs = {'ipc': 'host'}
args = p.get_docker_args(mock_cliargs)
self.assertTrue('--ipc host' in args)


class NetworkExtensionTest(unittest.TestCase):

def setUp(self):
Expand Down

0 comments on commit 5aad3d8

Please sign in to comment.