def test_rm(backend): c = Client(connection=backend()) c.mkdir(b"/foo/bar") c.rm(b"/foo/bar") with pytest.raises(PyXSError): c.read(b"/foo/bar") c.read(b"/foo/bar", b"baz") == b"baz" # using a default option. assert c.read(b"/foo") == b""
def test_client_read(backend): c = Client(connection=backend()) # a) non-existant path. try: c.read(b"/foo/bar") except PyXSError as e: assert e.args[0] == errno.ENOENT # b) OK-case (`/local` is allways in place). assert c.read("/local") == b"" assert c["/local"] == b""
def test_client_read(): for backend in [UnixSocketConnection, XenBusConnection]: c = Client(connection=backend()) # a) non-existant path. try: c.read("/foo/bar") except PyXSError as e: assert e.args[0] is errno.ENOENT # b) OK-case (`/local` is allways in place). assert c.read("/local") == "" assert c["/local"] == ""
def test_rm(): for backend in [UnixSocketConnection, XenBusConnection]: c = Client(connection=backend()) c.mkdir("/foo/bar") try: c.rm("/foo/bar") except PyXSError as e: pytest.fail("No error should've been raised, got: {0}".format(e)) with pytest.raises(PyXSError): c.read("/foo/bar") assert c.read("/foo") == ""
def test_mkdir(): for backend in [UnixSocketConnection, XenBusConnection]: c = Client(connection=backend()) c.mkdir("/foo/bar") assert c.ls("/foo") == ["bar"] assert c.read("/foo/bar") == ""
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"
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"
def test_rm(): for backend in [UnixSocketConnection, XenBusConnection]: c = Client(connection=backend()) c.mkdir("/foo/bar") try: c.rm("/foo/bar") except PyXSError as e: pytest.fail("No error should've been raised, got: {0}" .format(e)) with pytest.raises(PyXSError): c.read("/foo/bar") try: c.read("/foo/bar", "baz") == "baz" # using a default option. except PyXSError: pytest.fail("No error should've been raised, got: {0}" .format(e)) assert c.read("/foo") == ""
def test_mkdir(backend): c = Client(connection=backend()) c.mkdir(b"/foo/bar") assert c.ls(b"/foo") == [b"bar"] assert c.read(b"/foo/bar") == b""