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
Kirill Smelkov
ZODB
Commits
ee942336
Commit
ee942336
authored
Jun 13, 2016
by
Jim Fulton
Committed by
GitHub
Jun 13, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #65 from zopefoundation/winbot-failures
Fix winbot failures Thanks
parents
53c31a5f
1e16897c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
7 deletions
+27
-7
src/ZODB/tests/HistoryStorage.py
src/ZODB/tests/HistoryStorage.py
+5
-1
src/ZODB/tests/synchronizers.txt
src/ZODB/tests/synchronizers.txt
+8
-2
src/ZODB/tests/testFileStorage.py
src/ZODB/tests/testFileStorage.py
+14
-4
No files found.
src/ZODB/tests/HistoryStorage.py
View file @
ee942336
...
@@ -17,7 +17,8 @@ Any storage that supports the history() method should be able to pass
...
@@ -17,7 +17,8 @@ Any storage that supports the history() method should be able to pass
all these tests.
all these tests.
"""
"""
from
time
import
time
import
sys
from
time
import
time
,
sleep
from
ZODB.tests.MinPO
import
MinPO
from
ZODB.tests.MinPO
import
MinPO
class
HistoryStorage
:
class
HistoryStorage
:
...
@@ -31,6 +32,9 @@ class HistoryStorage:
...
@@ -31,6 +32,9 @@ class HistoryStorage:
self
.
assertRaises
(
KeyError
,
self
.
_storage
.
history
,
oid
)
self
.
assertRaises
(
KeyError
,
self
.
_storage
.
history
,
oid
)
revids
=
[
None
]
revids
=
[
None
]
for
data
in
data
:
for
data
in
data
:
if
sys
.
platform
==
'win32'
:
# time.time() has a precision of 1ms on Windows.
sleep
(
0.001
)
revids
.
append
(
self
.
_dostore
(
oid
,
revids
[
-
1
],
MinPO
(
data
)))
revids
.
append
(
self
.
_dostore
(
oid
,
revids
[
-
1
],
MinPO
(
data
)))
revids
.
reverse
()
revids
.
reverse
()
del
revids
[
-
1
]
del
revids
[
-
1
]
...
...
src/ZODB/tests/synchronizers.txt
View file @
ee942336
...
@@ -70,6 +70,10 @@ weren't called when the transaction commited. None of the test suites
...
@@ -70,6 +70,10 @@ weren't called when the transaction commited. None of the test suites
(ZODB's, Zope 2.8's, or Zope3's) caught that, but apparently Zope 3 takes this
(ZODB's, Zope 2.8's, or Zope3's) caught that, but apparently Zope 3 takes this
path at some point when serving pages.
path at some point when serving pages.
UPDATE: transaction 1.6.1 introduced a change that causes
newTransaction to be called when a synchronizer registeres with a
transaction manager with an active transaction.
>>> tm = transaction.ThreadTransactionManager()
>>> tm = transaction.ThreadTransactionManager()
>>> st.sync_called = False
>>> st.sync_called = False
>>> dummy = tm.begin() # we're doing this _before_ opening a connection
>>> dummy = tm.begin() # we're doing this _before_ opening a connection
...
@@ -77,7 +81,8 @@ path at some point when serving pages.
...
@@ -77,7 +81,8 @@ path at some point when serving pages.
>>> rt = cn.root() # make a change
>>> rt = cn.root() # make a change
>>> rt['c'] = 3
>>> rt['c'] = 3
>>> st.sync_called
>>> st.sync_called
False
True
>>> st.sync_called = False
Now ensure that ``cn.afterCompletion() -> st.sync()`` gets called by commit
Now ensure that ``cn.afterCompletion() -> st.sync()`` gets called by commit
despite that the `Connection` registered after the transaction began:
despite that the `Connection` registered after the transaction began:
...
@@ -96,7 +101,8 @@ And try the same thing with a non-threaded transaction manager:
...
@@ -96,7 +101,8 @@ And try the same thing with a non-threaded transaction manager:
>>> rt = cn.root() # make a change
>>> rt = cn.root() # make a change
>>> rt['d'] = 4
>>> rt['d'] = 4
>>> st.sync_called
>>> st.sync_called
False
True
>>> st.sync_called = False
>>> tm.commit()
>>> tm.commit()
>>> st.sync_called
>>> st.sync_called
True
True
...
...
src/ZODB/tests/testFileStorage.py
View file @
ee942336
...
@@ -15,6 +15,7 @@ import doctest
...
@@ -15,6 +15,7 @@ import doctest
import
os
import
os
if
os
.
environ
.
get
(
'USE_ZOPE_TESTING_DOCTEST'
):
if
os
.
environ
.
get
(
'USE_ZOPE_TESTING_DOCTEST'
):
from
zope.testing
import
doctest
from
zope.testing
import
doctest
import
sys
import
unittest
import
unittest
import
transaction
import
transaction
import
ZODB.FileStorage
import
ZODB.FileStorage
...
@@ -302,9 +303,18 @@ class FileStorageTests(
...
@@ -302,9 +303,18 @@ class FileStorageTests(
# is based on what was cached during the first load.
# is based on what was cached during the first load.
self
.
assertEqual
(
storage
.
load
(
z64
)[
0
],
b'foo'
if
fail
else
b'bar'
)
self
.
assertEqual
(
storage
.
load
(
z64
)[
0
],
b'foo'
if
fail
else
b'bar'
)
def
checkFlushNeededAfterTruncate
(
self
):
# We want to be sure that the above test detects any regression
self
.
_storage
.
_files
.
flush
=
lambda
:
None
# in the code it checks, because any bug here is like a time bomb: not
self
.
checkFlushAfterTruncate
(
True
)
# obvious, hard to reproduce, with possible data corruption.
# It's even more important that FilePool.flush() is quite aggressive and
# we'd like to optimize it when Python gets an API to flush read buffers.
# Therefore, 'checkFlushAfterTruncate' is tested in turn by another unit
# test.
# On Windows, flushing explicitely is not (always?) necessary.
if
sys
.
platform
!=
'win32'
:
def
checkFlushNeededAfterTruncate
(
self
):
self
.
_storage
.
_files
.
flush
=
lambda
:
None
self
.
checkFlushAfterTruncate
(
True
)
class
FileStorageHexTests
(
FileStorageTests
):
class
FileStorageHexTests
(
FileStorageTests
):
...
@@ -389,7 +399,7 @@ class AnalyzeDotPyTest(StorageTestBase.StorageTestBase):
...
@@ -389,7 +399,7 @@ class AnalyzeDotPyTest(StorageTestBase.StorageTestBase):
self
.
_storage
=
ZODB
.
FileStorage
.
FileStorage
(
"Source.fs"
,
create
=
True
)
self
.
_storage
=
ZODB
.
FileStorage
.
FileStorage
(
"Source.fs"
,
create
=
True
)
def
checkanalyze
(
self
):
def
checkanalyze
(
self
):
import
types
,
sys
import
types
from
BTrees.OOBTree
import
OOBTree
from
BTrees.OOBTree
import
OOBTree
from
ZODB.scripts
import
analyze
from
ZODB.scripts
import
analyze
...
...
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