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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
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
Hide 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():
wcfs
.
join
(
zurl
,
autostart
=
False
)
wc
=
wcfs
.
_start
(
zurl
)
x
defer
(
wc
.
close
)
defer
(
wc
.
close
)
assert
wc
.
mountpoint
==
testmntpt
assert
readfile
(
wc
.
mountpoint
+
"/.wcfs/zurl"
)
==
zurl
assert
os
.
path
.
isdir
(
wc
.
mountpoint
+
"/head"
)
assert
os
.
path
.
isdir
(
wc
.
mountpoint
+
"/head/bigfile"
)
wc2
=
wcfs
.
join
(
zurl
,
autostart
=
False
)
x
defer
(
wc2
.
close
)
defer
(
wc2
.
close
)
assert
wc2
.
mountpoint
==
wc
.
mountpoint
# test that join(autostart=y) works.
...
...
@@ -118,7 +118,7 @@ def test_join_autostart():
wcfs
.
join
(
zurl
,
autostart
=
False
)
wc
=
wcfs
.
join
(
zurl
,
autostart
=
True
)
x
defer
(
wc
.
close
)
defer
(
wc
.
close
)
assert
wc
.
mountpoint
==
testmntpt
assert
readfile
(
wc
.
mountpoint
+
"/.wcfs/zurl"
)
==
zurl
assert
os
.
path
.
isdir
(
wc
.
mountpoint
+
"/head"
)
...
...
@@ -162,7 +162,7 @@ class DFile:
# 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.
# A BigFile opened under tDB is represented as tFile - see .open for details.
...
...
@@ -175,7 +175,7 @@ class DFile:
#
# 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 ?
class
tDB
:
...
...
@@ -451,7 +451,7 @@ class tFile:
# - see "7.2) for all registered client@at watchers ..."
#
# 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
def
assertBlk
(
t
,
blk
,
dataok
,
pinokByWLink
=
None
):
#print('assertBlk #%d' % blk)
...
...
@@ -1149,8 +1149,8 @@ def _expectPin(twlink, ctx, zf, expect): # -> []tSrvReq
@
func
def
test_wcfs
():
t
=
tDB
()
x
defer
(
t
.
close
)
x
defer
(
t
.
dump_history
)
defer
(
t
.
close
)
defer
(
t
.
dump_history
)
t
.
root
[
'!file'
]
=
nonfile
=
Persistent
()
t
.
root
[
'zfile'
]
=
zf
=
ZBigFile
(
blksize
)
...
...
@@ -1473,7 +1473,7 @@ def tidtime(tid):
@
func
def
test_tidtime_notrough
():
t
=
tDB
()
x
defer
(
t
.
close
)
defer
(
t
.
close
)
atprev
=
t
.
commit
()
for
i
in
range
(
10
):
...
...
@@ -1540,6 +1540,7 @@ def dump_history(t):
# whether and which an assert in the test failed.
#
# XXX merge into defer?
_defer
=
defer
# original golang.defer
def
xdefer
(
f
):
# hack - imitate as if defer called from under xdefer was called directly by caller func
fgo
=
inspect
.
currentframe
().
f_back
.
f_back
...
...
@@ -1555,4 +1556,8 @@ def _xdefer(f):
except
:
traceback
.
print_exception
(
exc_type
,
exc_value
,
exc_traceback
)
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