コード例 #1
0
ファイル: test_client.py プロジェクト: srm4/pyxs
def test_write(backend):
    c = Client(connection=backend())

    c.write(b"/foo/bar", b"baz")
    assert c.read(b"/foo/bar") == b"baz"

    c[b"/foo/bar"] = b"boo"
    assert c[b"/foo/bar"] == b"boo"
コード例 #2
0
ファイル: tests.py プロジェクト: brkt/pyxs
def test_write():
    for backend in [UnixSocketConnection, XenBusConnection]:
        c = Client(connection=backend())

        c.write("/foo/bar", "baz")
        assert c.read("/foo/bar") == "baz"

        c["/foo/bar"] = "boo"
        assert c["/foo/bar"] == "boo"
コード例 #3
0
ファイル: tests.py プロジェクト: royjenkins/pyxs
def test_write():
    for backend in [UnixSocketConnection, XenBusConnection]:
        c = Client(connection=backend())

        c.write("/foo/bar", "baz")
        assert c.read("/foo/bar") == "baz"

        c["/foo/bar"] = "boo"
        assert c["/foo/bar"] == "boo"
コード例 #4
0
ファイル: test_client.py プロジェクト: srm4/pyxs
def test_watches(backend):
    c = Client(connection=backend())
    c.write(b"/foo/bar", b"baz")
    m = c.monitor()
    m.watch(b"/foo/bar", b"boo")

    # a) we receive the first event immediately, so `wait()` doesn't
    #    block.
    assert m.wait() == (b"/foo/bar", b"boo")

    # b) before the second call we have to make sure someone
    #    will change the path being watched.
    Timer(.5, lambda: c.write(b"/foo/bar", b"baz")).run()
    assert m.wait() == (b"/foo/bar", b"boo")

    # c) changing a children of the watched path triggers watch
    #    event as well.
    Timer(.5, lambda: c.write(b"/foo/bar/baz", b"???")).run()
    assert m.wait() == (b"/foo/bar/baz", b"boo")
コード例 #5
0
ファイル: tests.py プロジェクト: royjenkins/pyxs
def test_watches():
    for backend in [UnixSocketConnection, XenBusConnection]:
        c = Client(connection=backend())
        c.write("/foo/bar", "baz")
        m = c.monitor()
        m.watch("/foo/bar", "boo")

        # a) we receive the first event immediately, so `wait()` doesn't
        #    block.
        assert m.wait() == ("/foo/bar", "boo")

        # b) before the second call we have to make sure someone
        #    will change the path being watched.
        Timer(.5, lambda: c.write("/foo/bar", "baz")).run()
        assert m.wait() == ("/foo/bar", "boo")

        # c) changing a children of the watched path triggers watch
        #    event as well.
        Timer(.5, lambda: c.write("/foo/bar/baz", "???")).run()
        assert m.wait() == ("/foo/bar/baz", "boo")