예제 #1
0
 def test_multiple_entries(self):
     namespace = plash.namespace.Namespace()
     namespace.attach_at_path("/foo", TestObject())
     namespace.attach_at_path("/bar", TestObject())
     listing = namespace.get_root_dir().dir_list()
     self.assertEquals(sorted(entry["name"] for entry in listing),
                       ["bar", "foo"])
예제 #2
0
 def x_test_overwrite_entry(self):
     namespace = plash.namespace.Namespace()
     namespace.attach_at_path("/foo", TestObject())
     namespace.attach_at_path("/foo", TestObject())
     listing = namespace.get_root_dir().dir_list()
     self.assertEquals([entry["name"] for entry in listing],
                       ["foo"])
예제 #3
0
파일: hellow.py 프로젝트: pombredanne/plash
import plash.mainloop
import plash.namespace
import plash.namespace as ns
import plash.pola_run_args
import plash.process


caller_root = plash.env.get_root_dir()
namespace = plash.namespace.Namespace()
namespace.resolve_populate(caller_root, "/bin")
namespace.resolve_populate(caller_root, "/lib")
namespace.resolve_populate(caller_root, "/usr")
namespace.resolve_populate(caller_root, "/dev/null", flags=ns.FS_OBJECT_RW)
# This is for when running under tests:
if "PLASH_LIBRARY_DIR" in os.environ:
    namespace.resolve_populate(caller_root, os.environ["PLASH_LIBRARY_DIR"], flags=ns.FS_FOLLOW_SYMLINKS)
root = namespace.get_root_dir()
fs_op = ns.make_fs_op(root)

p = plash.process.ProcessSpec()
p.env = os.environ.copy()
p.caps = {"fs_op": fs_op, "conn_maker": ns.conn_maker}
p.setcmd("/bin/echo", "Hello world!")

setup = plash.pola_run_args.ProcessSetup(p)
forwarders = setup.grant_proxy_terminal_access()

pid = p.spawn()
plash.pola_run_args.flush_and_return_status_on_child_exit(pid, [])
plash.mainloop.run_server()
예제 #4
0
 def test_call(self):
     namespace = plash.namespace.Namespace()
     mock_dir = MockDir()
     namespace.attach_at_path("/", mock_dir)
     namespace.get_root_dir().dir_mkdir(0777, "blargh")
     self.assertEquals(mock_dir._calls, ["blargh"])
예제 #5
0
 def test_empty_namespace(self):
     namespace = plash.namespace.Namespace()
     self.assertEquals(namespace.get_root_dir().dir_list(), [])