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
c6f3c3f5
Commit
c6f3c3f5
authored
Jun 27, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
8bfa791b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
4 deletions
+25
-4
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+25
-4
No files found.
wcfs/wcfs_test.py
View file @
c6f3c3f5
...
...
@@ -19,7 +19,7 @@
# See https://www.nexedi.com/licensing for rationale and options.
"""wcfs_test tests wcfs filesystem from outside as python client process"""
from
__future__
import
print_function
from
__future__
import
print_function
,
absolute_import
from
wendelin.lib.testing
import
getTestDB
from
wendelin.lib.zodb
import
dbclose
...
...
@@ -34,6 +34,7 @@ from persistent.timestamp import TimeStamp
from
ZODB.utils
import
z64
,
u64
,
p64
import
sys
,
os
,
os
.
path
,
subprocess
,
threading
,
inspect
,
traceback
,
re
from
time
import
gmtime
from
errno
import
EINVAL
from
golang
import
go
,
chan
,
select
,
func
,
defer
from
golang
import
context
,
sync
,
time
...
...
@@ -1749,16 +1750,36 @@ def tidtime(tid):
# NOTE pytest.approx supports only ==, not e.g. <, so we use plain round.
return
round
(
t
,
6
)
# tidfromtime converts time into corresponding transacton ID.
def
tidfromtime
(
t
):
f
=
t
-
int
(
t
)
# fraction of seconds
t
=
int
(
t
)
_
=
gmtime
(
t
)
s
=
_
.
tm_sec
+
f
# total seconds
ts
=
TimeStamp
(
_
.
tm_year
,
_
.
tm_mon
,
_
.
tm_mday
,
_
.
tm_hour
,
_
.
tm_min
,
s
)
return
ts
.
raw
()
# verify that tidtime is precise enough to show difference in between transactions.
# verify that tidtime -> tidfromtime is identity withing rounding tolerance.
@
func
def
test_tidtime
_notrough
():
def
test_tidtime
():
t
=
tDB
()
defer
(
t
.
close
)
atprev
=
t
.
commit
()
# tidtime not rough
atv
=
[
t
.
commit
()]
for
i
in
range
(
10
):
at
=
t
.
commit
()
assert
tidtime
(
at
)
>
tidtime
(
atprev
)
assert
tidtime
(
at
)
>
tidtime
(
atv
[
-
1
])
atv
.
append
(
at
)
# tidtime -> tidfromtime
for
at
in
atv
:
tat
=
tidtime
(
at
)
at_
=
tidfromtime
(
tat
)
tat_
=
tidtime
(
at_
)
assert
abs
(
tat_
-
tat
)
<=
2E-6
# tAt is bytes whose repr returns human readable string considering it as `at` under tDB.
...
...
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