Commit eb3a732f authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 04e8a863
......@@ -27,6 +27,7 @@ from pytest import raises
testdb = None
testzurl = None
testmntpt = None
def setup_module():
global testdb, testzurl, testmntpt
testdb = getTestDB()
......@@ -45,7 +46,7 @@ def teardown_module():
def setup_function(f):
assert not os.path.exists(testmntpt)
# make sure we unmount wcfs after every function
# make sure we unmount wcfs after every test
def teardown_function(f):
mounted = not subprocess.call(["mountpoint", "-q", testmntpt])
if mounted:
......@@ -59,24 +60,38 @@ def readfile(path):
with open(path) as f:
return f.read()
# check that zurl does not change from one open to another storage open.
def test_zurlstable():
for i in range(10):
zstor = testdb.getZODBStorage()
zurl = wcfs._zstor_2zurl(zstor)
zstor.close()
assert zurl == testzurl
def test_join():
zstor = testdb.getZODBStorage()
zurl = wcfs._zstor_2zurl(zstor)
zurl = testzurl
with raises(RuntimeError, match="wcfs: join .*: server not started"):
wcfs.join(zurl, autostart=False)
wc = wcfs._start(zurl)
assert wc.mountpoint == testmntpt
assert readfile(wc.mountpoint + "/.wcfs") == zurl
wc2 = wcfs.join(zurl, autostart=False)
assert wc2.mountpoint == wc.mountpoint
wc.close()
wc2.close()
zstor.close()
def test_join_autostart():
# XXX
pass
zurl = testzurl
with raises(RuntimeError, match="wcfs: join .*: server not started"):
wcfs.join(zurl, autostart=False)
wc = wcfs.join(zurl, autostart=True)
assert wc.mountpoint == testmntpt
assert readfile(wc.mountpoint + "/.wcfs") == zurl
wc.close()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment