Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
c462756b
Commit
c462756b
authored
Jun 20, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
89d48dfc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
10 deletions
+15
-10
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+15
-10
No files found.
wcfs/wcfs_test.py
View file @
c462756b
...
@@ -100,14 +100,14 @@ def test_join():
...
@@ -100,14 +100,14 @@ def test_join():
wcfs
.
join
(
zurl
,
autostart
=
False
)
wcfs
.
join
(
zurl
,
autostart
=
False
)
wc
=
wcfs
.
_start
(
zurl
)
wc
=
wcfs
.
_start
(
zurl
)
x
defer
(
wc
.
close
)
defer
(
wc
.
close
)
assert
wc
.
mountpoint
==
testmntpt
assert
wc
.
mountpoint
==
testmntpt
assert
readfile
(
wc
.
mountpoint
+
"/.wcfs/zurl"
)
==
zurl
assert
readfile
(
wc
.
mountpoint
+
"/.wcfs/zurl"
)
==
zurl
assert
os
.
path
.
isdir
(
wc
.
mountpoint
+
"/head"
)
assert
os
.
path
.
isdir
(
wc
.
mountpoint
+
"/head"
)
assert
os
.
path
.
isdir
(
wc
.
mountpoint
+
"/head/bigfile"
)
assert
os
.
path
.
isdir
(
wc
.
mountpoint
+
"/head/bigfile"
)
wc2
=
wcfs
.
join
(
zurl
,
autostart
=
False
)
wc2
=
wcfs
.
join
(
zurl
,
autostart
=
False
)
x
defer
(
wc2
.
close
)
defer
(
wc2
.
close
)
assert
wc2
.
mountpoint
==
wc
.
mountpoint
assert
wc2
.
mountpoint
==
wc
.
mountpoint
# test that join(autostart=y) works.
# test that join(autostart=y) works.
...
@@ -118,7 +118,7 @@ def test_join_autostart():
...
@@ -118,7 +118,7 @@ def test_join_autostart():
wcfs
.
join
(
zurl
,
autostart
=
False
)
wcfs
.
join
(
zurl
,
autostart
=
False
)
wc
=
wcfs
.
join
(
zurl
,
autostart
=
True
)
wc
=
wcfs
.
join
(
zurl
,
autostart
=
True
)
x
defer
(
wc
.
close
)
defer
(
wc
.
close
)
assert
wc
.
mountpoint
==
testmntpt
assert
wc
.
mountpoint
==
testmntpt
assert
readfile
(
wc
.
mountpoint
+
"/.wcfs/zurl"
)
==
zurl
assert
readfile
(
wc
.
mountpoint
+
"/.wcfs/zurl"
)
==
zurl
assert
os
.
path
.
isdir
(
wc
.
mountpoint
+
"/head"
)
assert
os
.
path
.
isdir
(
wc
.
mountpoint
+
"/head"
)
...
@@ -162,7 +162,7 @@ class DFile:
...
@@ -162,7 +162,7 @@ class DFile:
# tDB provides database/wcfs testing environment.
# tDB provides database/wcfs testing environment.
#
#
# Database root and wcfs connection are represented by .root and .wc correspondingly
# Database root and wcfs connection are represented by .root and .wc correspondingly
.
#
#
# The primary way to access wcfs is by opening BigFiles and Watches.
# The primary way to access wcfs is by opening BigFiles and Watches.
# A BigFile opened under tDB is represented as tFile - see .open for details.
# A BigFile opened under tDB is represented as tFile - see .open for details.
...
@@ -175,7 +175,7 @@ class DFile:
...
@@ -175,7 +175,7 @@ class DFile:
#
#
# tDB must be explicitly closed once no longer used.
# tDB must be explicitly closed once no longer used.
#
#
# Raw files on wcfs can be accessed with ._path/._read/._stat/._open
# Raw files on wcfs can be accessed with ._path/._read/._stat/._open
.
#
#
# XXX print -> t.trace/debug() + t.verbose depending on py.test -v -v ?
# XXX print -> t.trace/debug() + t.verbose depending on py.test -v -v ?
class
tDB
:
class
tDB
:
...
@@ -451,7 +451,7 @@ class tFile:
...
@@ -451,7 +451,7 @@ class tFile:
# - see "7.2) for all registered client@at watchers ..."
# - see "7.2) for all registered client@at watchers ..."
#
#
# pinokByWLink: {} tWatchLink -> {} blk -> at.
# pinokByWLink: {} tWatchLink -> {} blk -> at.
# pinokByWLink can be
None - in that case it is computed
automatically.
# pinokByWLink can be
omitted - in that case it is computed only
automatically.
@
func
@
func
def
assertBlk
(
t
,
blk
,
dataok
,
pinokByWLink
=
None
):
def
assertBlk
(
t
,
blk
,
dataok
,
pinokByWLink
=
None
):
#print('assertBlk #%d' % blk)
#print('assertBlk #%d' % blk)
...
@@ -1149,8 +1149,8 @@ def _expectPin(twlink, ctx, zf, expect): # -> []tSrvReq
...
@@ -1149,8 +1149,8 @@ def _expectPin(twlink, ctx, zf, expect): # -> []tSrvReq
@
func
@
func
def
test_wcfs
():
def
test_wcfs
():
t
=
tDB
()
t
=
tDB
()
x
defer
(
t
.
close
)
defer
(
t
.
close
)
x
defer
(
t
.
dump_history
)
defer
(
t
.
dump_history
)
t
.
root
[
'!file'
]
=
nonfile
=
Persistent
()
t
.
root
[
'!file'
]
=
nonfile
=
Persistent
()
t
.
root
[
'zfile'
]
=
zf
=
ZBigFile
(
blksize
)
t
.
root
[
'zfile'
]
=
zf
=
ZBigFile
(
blksize
)
...
@@ -1473,7 +1473,7 @@ def tidtime(tid):
...
@@ -1473,7 +1473,7 @@ def tidtime(tid):
@
func
@
func
def
test_tidtime_notrough
():
def
test_tidtime_notrough
():
t
=
tDB
()
t
=
tDB
()
x
defer
(
t
.
close
)
defer
(
t
.
close
)
atprev
=
t
.
commit
()
atprev
=
t
.
commit
()
for
i
in
range
(
10
):
for
i
in
range
(
10
):
...
@@ -1540,6 +1540,7 @@ def dump_history(t):
...
@@ -1540,6 +1540,7 @@ def dump_history(t):
# whether and which an assert in the test failed.
# whether and which an assert in the test failed.
#
#
# XXX merge into defer?
# XXX merge into defer?
_defer
=
defer
# original golang.defer
def
xdefer
(
f
):
def
xdefer
(
f
):
# hack - imitate as if defer called from under xdefer was called directly by caller func
# hack - imitate as if defer called from under xdefer was called directly by caller func
fgo
=
inspect
.
currentframe
().
f_back
.
f_back
fgo
=
inspect
.
currentframe
().
f_back
.
f_back
...
@@ -1555,4 +1556,8 @@ def _xdefer(f):
...
@@ -1555,4 +1556,8 @@ def _xdefer(f):
except
:
except
:
traceback
.
print_exception
(
exc_type
,
exc_value
,
exc_traceback
)
traceback
.
print_exception
(
exc_type
,
exc_value
,
exc_traceback
)
raise
raise
defer
(
_
)
_defer
(
_
)
# replace defer with xdefer
defer
=
xdefer
del
xdefer
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment