tests: move stub tools, into subdir, import docker_test.
parent
7647c95f34
commit
73055150f3
@ -0,0 +1,5 @@
|
||||
|
||||
# stubs/
|
||||
|
||||
Dummy implementations of various third party tools that just spawn local Python
|
||||
interpreters. Used to roughly test the tools' associated Mitogen classes.
|
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
os.environ['ORIGINAL_ARGV'] = repr(sys.argv)
|
||||
os.execv(sys.executable, sys.argv[sys.argv.index('-c') - 1:])
|
@ -0,0 +1,28 @@
|
||||
import os
|
||||
|
||||
import mitogen
|
||||
|
||||
import unittest2
|
||||
|
||||
import testlib
|
||||
|
||||
|
||||
class ConstructorTest(testlib.RouterMixin, unittest2.TestCase):
|
||||
def test_okay(self):
|
||||
docker_path = testlib.data_path('stubs/docker.py')
|
||||
context = self.router.docker(
|
||||
container='container_name',
|
||||
docker_path=docker_path,
|
||||
)
|
||||
stream = self.router.stream_by_id(context.context_id)
|
||||
|
||||
argv = eval(context.call(os.getenv, 'ORIGINAL_ARGV'))
|
||||
self.assertEquals(argv[0], docker_path)
|
||||
self.assertEquals(argv[1], 'exec')
|
||||
self.assertEquals(argv[2], '--interactive')
|
||||
self.assertEquals(argv[3], 'container_name')
|
||||
self.assertEquals(argv[4], stream.python_path)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest2.main()
|
Loading…
Reference in New Issue