Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZODB
Commits
1ec917e7
Commit
1ec917e7
authored
Jan 04, 2009
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a spurious windows error due to Window's low-resolution clock.
parent
25b9f257
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
6 deletions
+21
-6
src/ZODB/DemoStorage.test
src/ZODB/DemoStorage.test
+21
-6
No files found.
src/ZODB/DemoStorage.test
View file @
1ec917e7
...
@@ -5,6 +5,17 @@ DemoStorage demo (doctest)
...
@@ -5,6 +5,17 @@ DemoStorage demo (doctest)
DemoStorages
provide
a
way
to
provide
incremental
updates
to
an
DemoStorages
provide
a
way
to
provide
incremental
updates
to
an
existing
,
base
,
storage
without
updating
the
storage
.
existing
,
base
,
storage
without
updating
the
storage
.
..
We
need
to
mess
with
time
to
prevent
spurious
test
failures
on
windows
>>>
now
=
1231019584.0
>>>
def
faux_time_time
()
:
...
global
now
...
now
+=
.
1
...
return
now
>>>
import
time
>>>
real_time_time
=
time
.
time
>>>
time
.
time
=
faux_time_time
To
see
how
this
works
,
we
'll start by creating a base storage and
To
see
how
this
works
,
we
'll start by creating a base storage and
puting an object (in addition to the root object) in it:
puting an object (in addition to the root object) in it:
...
@@ -73,7 +84,7 @@ Our lastTransaction reflects the lastTransaction of the changes:
...
@@ -73,7 +84,7 @@ Our lastTransaction reflects the lastTransaction of the changes:
>>> storage.lastTransaction() == changes.lastTransaction()
>>> storage.lastTransaction() == changes.lastTransaction()
True
True
Let'
s
walk
over
some
of
the
methods
so
e
we
can
see
how
we
delegate
to
Let'
s
walk
over
some
of
the
methods
so
we
can
see
how
we
delegate
to
the
new
underlying
storages
:
the
new
underlying
storages
:
>>>
from
ZODB
.
utils
import
p64
,
u64
>>>
from
ZODB
.
utils
import
p64
,
u64
...
@@ -108,11 +119,11 @@ Let's look at some other methods:
...
@@ -108,11 +119,11 @@ Let's look at some other methods:
>>> storage.getSize() == changes.getSize()
>>> storage.getSize() == changes.getSize()
True
True
>>> len(storage) == len(changes)
>>> len(storage) == len(changes)
True
True
Undo methods are simply copied from the changes storage:
Undo methods are simply copied from the changes storage:
>>> [getattr(storage, name) == getattr(changes, name)
>>> [getattr(storage, name) == getattr(changes, name)
...
@@ -210,7 +221,7 @@ DemoStorage supports Blobs if the changes database supports blobs.
...
@@ -210,7 +221,7 @@ DemoStorage supports Blobs if the changes database supports blobs.
>>>
transaction
.
commit
()
>>>
transaction
.
commit
()
>>>
conn
.
root
()[
'blob'
]
.
open
()
.
read
()
>>>
conn
.
root
()[
'blob'
]
.
open
()
.
read
()
'state 2'
'state 2'
>>>
storage
.
temporaryDirectory
()
==
changes
.
temporaryDirectory
()
>>>
storage
.
temporaryDirectory
()
==
changes
.
temporaryDirectory
()
True
True
...
@@ -257,7 +268,7 @@ storage wrapped around it when necessary:
...
@@ -257,7 +268,7 @@ storage wrapped around it when necessary:
>>> transaction.commit()
>>> transaction.commit()
>>> conn.root()['
blob
'].open().read()
>>> conn.root()['
blob
'].open().read()
'
state
2
'
'
state
2
'
>>> storage.temporaryDirectory() == storage.changes.temporaryDirectory()
>>> storage.temporaryDirectory() == storage.changes.temporaryDirectory()
True
True
...
@@ -271,7 +282,7 @@ storage wrapped around it when necessary:
...
@@ -271,7 +282,7 @@ storage wrapped around it when necessary:
>>>
conn
.
close
()
>>>
conn
.
close
()
>>>
blobdir
=
storage
.
temporaryDirectory
()
>>>
blobdir
=
storage
.
temporaryDirectory
()
>>>
del
db
,
conn
,
storage
,
_
>>>
del
db
,
conn
,
storage
,
_
>>>
import
gc
>>>
import
gc
>>>
_
=
gc
.
collect
()
>>>
_
=
gc
.
collect
()
...
@@ -378,3 +389,7 @@ DemoStorage keeps up with the issued OIDs to know when not to reissue them...
...
@@ -378,3 +389,7 @@ DemoStorage keeps up with the issued OIDs to know when not to reissue them...
We
'
re
done
with
the
storage
,
so
"unwrap"
the
underlying
storage
.
We
'
re
done
with
the
storage
,
so
"unwrap"
the
underlying
storage
.
>>>
storage
=
storage
.
pop
()
>>>
storage
=
storage
.
pop
()
..
restore
time
>>>
time
.
time
=
real_time_time
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