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
690c699c
Commit
690c699c
authored
Feb 15, 2013
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Py3k namnyisms: 'fail{If,Unless}' -> 'assert{False,True}'.
parent
9509d1a6
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
31 additions
and
30 deletions
+31
-30
src/ZODB/scripts/manual_tests/testfstest.py
src/ZODB/scripts/manual_tests/testfstest.py
+1
-1
src/ZODB/scripts/tests/test_repozo.py
src/ZODB/scripts/tests/test_repozo.py
+9
-9
src/ZODB/tests/Corruption.py
src/ZODB/tests/Corruption.py
+2
-2
src/ZODB/tests/MTStorage.py
src/ZODB/tests/MTStorage.py
+2
-1
src/ZODB/tests/TransactionalUndoStorage.py
src/ZODB/tests/TransactionalUndoStorage.py
+3
-3
src/ZODB/tests/testConnection.py
src/ZODB/tests/testConnection.py
+2
-2
src/ZODB/tests/testPersistentList.py
src/ZODB/tests/testPersistentList.py
+8
-8
src/ZODB/tests/testZODB.py
src/ZODB/tests/testZODB.py
+3
-3
src/ZODB/tests/testfsIndex.py
src/ZODB/tests/testfsIndex.py
+1
-1
No files found.
src/ZODB/scripts/manual_tests/testfstest.py
View file @
690c699c
...
...
@@ -41,7 +41,7 @@ class TestCorruptedFS(ZODB.tests.util.TestCase):
fstest
.
check
(
self
.
_temp
)
except
FormatError
as
msg
:
mo
=
re
.
search
(
rx
,
str
(
msg
))
self
.
failIf
(
mo
is
None
,
"unexpected error: %s"
%
msg
)
self
.
assertFalse
(
mo
is
None
,
"unexpected error: %s"
%
msg
)
else
:
self
.
fail
(
"fstest did not detect corruption"
)
...
...
src/ZODB/scripts/tests/test_repozo.py
View file @
690c699c
...
...
@@ -268,7 +268,7 @@ class Test_concat(OptionsTestBase, unittest.TestCase):
ofp
=
Faux
()
bytes
,
sum
=
self
.
_callFUT
(
files
,
ofp
)
self
.
assertEqual
(
ofp
.
_written
,
[
x
.
encode
()
for
x
in
'ABC'
])
self
.
failUnless
(
ofp
.
_closed
)
self
.
assertTrue
(
ofp
.
_closed
)
_marker
=
object
()
class
Test_gen_filename
(
OptionsTestBase
,
unittest
.
TestCase
):
...
...
@@ -460,7 +460,7 @@ class Test_delete_old_backups(OptionsTestBase, unittest.TestCase):
self
.
assertEqual
(
len
(
remaining
),
len
(
FILENAMES
))
for
name
in
FILENAMES
:
fqn
=
os
.
path
.
join
(
self
.
_repository_directory
,
name
)
self
.
failUnless
(
os
.
path
.
isfile
(
fqn
))
self
.
assertTrue
(
os
.
path
.
isfile
(
fqn
))
def
test_doesnt_remove_current_repozo_files
(
self
):
FILENAMES
=
[
'2009-12-20-10-08-03.fs'
,
...
...
@@ -472,7 +472,7 @@ class Test_delete_old_backups(OptionsTestBase, unittest.TestCase):
self
.
assertEqual
(
len
(
remaining
),
len
(
FILENAMES
))
for
name
in
FILENAMES
:
fqn
=
os
.
path
.
join
(
self
.
_repository_directory
,
name
)
self
.
failUnless
(
os
.
path
.
isfile
(
fqn
))
self
.
assertTrue
(
os
.
path
.
isfile
(
fqn
))
def
test_removes_older_repozo_files
(
self
):
OLDER_FULL
=
[
'2009-12-20-00-01-03.fs'
,
...
...
@@ -494,13 +494,13 @@ class Test_delete_old_backups(OptionsTestBase, unittest.TestCase):
self
.
assertEqual
(
len
(
remaining
),
len
(
CURRENT_FULL
))
for
name
in
OLDER_FULL
:
fqn
=
os
.
path
.
join
(
self
.
_repository_directory
,
name
)
self
.
failIf
(
os
.
path
.
isfile
(
fqn
))
self
.
assertFalse
(
os
.
path
.
isfile
(
fqn
))
for
name
in
DELTAS
:
fqn
=
os
.
path
.
join
(
self
.
_repository_directory
,
name
)
self
.
failIf
(
os
.
path
.
isfile
(
fqn
))
self
.
assertFalse
(
os
.
path
.
isfile
(
fqn
))
for
name
in
CURRENT_FULL
:
fqn
=
os
.
path
.
join
(
self
.
_repository_directory
,
name
)
self
.
failUnless
(
os
.
path
.
isfile
(
fqn
))
self
.
assertTrue
(
os
.
path
.
isfile
(
fqn
))
def
test_removes_older_repozo_files_zipped
(
self
):
OLDER_FULL
=
[
'2009-12-20-00-01-03.fsz'
,
...
...
@@ -522,13 +522,13 @@ class Test_delete_old_backups(OptionsTestBase, unittest.TestCase):
self
.
assertEqual
(
len
(
remaining
),
len
(
CURRENT_FULL
))
for
name
in
OLDER_FULL
:
fqn
=
os
.
path
.
join
(
self
.
_repository_directory
,
name
)
self
.
failIf
(
os
.
path
.
isfile
(
fqn
))
self
.
assertFalse
(
os
.
path
.
isfile
(
fqn
))
for
name
in
DELTAS
:
fqn
=
os
.
path
.
join
(
self
.
_repository_directory
,
name
)
self
.
failIf
(
os
.
path
.
isfile
(
fqn
))
self
.
assertFalse
(
os
.
path
.
isfile
(
fqn
))
for
name
in
CURRENT_FULL
:
fqn
=
os
.
path
.
join
(
self
.
_repository_directory
,
name
)
self
.
failUnless
(
os
.
path
.
isfile
(
fqn
))
self
.
assertTrue
(
os
.
path
.
isfile
(
fqn
))
class
Test_do_full_backup
(
OptionsTestBase
,
unittest
.
TestCase
):
...
...
src/ZODB/tests/Corruption.py
View file @
690c699c
...
...
@@ -44,7 +44,7 @@ class FileStorageCorruptTests(StorageTestBase):
self
.
_close
()
# truncation the index file
self
.
failUnless
(
os
.
path
.
exists
(
'Data.fs.index'
))
self
.
assertTrue
(
os
.
path
.
exists
(
'Data.fs.index'
))
f
=
open
(
'Data.fs.index'
,
'rb+'
)
f
.
seek
(
0
,
2
)
size
=
f
.
tell
()
...
...
@@ -60,7 +60,7 @@ class FileStorageCorruptTests(StorageTestBase):
self
.
_close
()
# truncation the index file
self
.
failUnless
(
os
.
path
.
exists
(
'Data.fs.index'
))
self
.
assertTrue
(
os
.
path
.
exists
(
'Data.fs.index'
))
size
=
os
.
stat
(
'Data.fs.index'
)[
stat
.
ST_SIZE
]
f
=
open
(
'Data.fs.index'
,
'rb+'
)
while
f
.
tell
()
<
size
:
...
...
src/ZODB/tests/MTStorage.py
View file @
690c699c
...
...
@@ -220,7 +220,8 @@ class MTStorage:
for
t
in
threads
:
t
.
join
(
60
)
for
t
in
threads
:
self
.
failIf
(
t
.
isAlive
(),
"thread failed to finish in 60 seconds"
)
self
.
assertFalse
(
t
.
isAlive
(),
"thread failed to finish in 60 seconds"
)
def
check2ZODBThreads
(
self
):
db
=
ZODB
.
DB
(
self
.
_storage
)
...
...
src/ZODB/tests/TransactionalUndoStorage.py
View file @
690c699c
...
...
@@ -249,7 +249,7 @@ class TransactionalUndoStorage:
def
checkTwoObjectUndoAtOnce
(
self
):
# Convenience
eq
=
self
.
assertEqual
unless
=
self
.
failUnless
unless
=
self
.
assertTrue
p30
,
p31
,
p32
,
p50
,
p51
,
p52
=
map
(
zodb_pickle
,
map
(
MinPO
,
(
30
,
31
,
32
,
50
,
51
,
52
)))
...
...
@@ -357,8 +357,8 @@ class TransactionalUndoStorage:
oids
=
self
.
_begin_undos_vote
(
t
,
tid
)
self
.
_storage
.
tpc_finish
(
t
)
eq
(
len
(
oids
),
1
)
self
.
failUnless
(
oid1
in
oids
)
self
.
failUnless
(
not
oid2
in
oids
)
self
.
assertTrue
(
oid1
in
oids
)
self
.
assertTrue
(
not
oid2
in
oids
)
data
,
revid1
=
self
.
_storage
.
load
(
oid1
,
''
)
eq
(
zodb_unpickle
(
data
),
MinPO
(
33
))
data
,
revid2
=
self
.
_storage
.
load
(
oid2
,
''
)
...
...
src/ZODB/tests/testConnection.py
View file @
690c699c
...
...
@@ -161,8 +161,8 @@ class ConnectionDotAdd(ZODB.tests.util.TestCase):
old_cache
=
self
.
datamgr
.
_cache
self
.
datamgr
.
_resetCache
()
new_cache
=
self
.
datamgr
.
_cache
self
.
failIf
(
new_cache
is
old_cache
)
self
.
failUnless
(
self
.
datamgr
.
_reader
.
_cache
is
new_cache
)
self
.
assertFalse
(
new_cache
is
old_cache
)
self
.
assertTrue
(
self
.
datamgr
.
_reader
.
_cache
is
new_cache
)
class
UserMethodTests
(
unittest
.
TestCase
):
...
...
src/ZODB/tests/testPersistentList.py
View file @
690c699c
...
...
@@ -124,9 +124,9 @@ class TestPList(unittest.TestCase):
# Test __contains__
for
i
in
u2
:
self
.
failUnless
(
i
in
u2
,
"i in u2"
)
self
.
assertTrue
(
i
in
u2
,
"i in u2"
)
for
i
in
min
(
u2
)
-
1
,
max
(
u2
)
+
1
:
self
.
failUnless
(
i
not
in
u2
,
"i not in u2"
)
self
.
assertTrue
(
i
not
in
u2
,
"i not in u2"
)
# Test __delslice__
...
...
@@ -142,12 +142,12 @@ class TestPList(unittest.TestCase):
# Test __add__, __radd__, __mul__ and __rmul__
#self.
failUnless
(u1 + [] == [] + u1 == u1, "u1 + [] == [] + u1 == u1")
self
.
failUnless
(
u1
+
[
1
]
==
u2
,
"u1 + [1] == u2"
)
#self.
failUnless
([-1] + u1 == [-1, 0], "[-1] + u1 == [-1, 0]")
self
.
failUnless
(
u2
==
u2
*
1
==
1
*
u2
,
"u2 == u2*1 == 1*u2"
)
self
.
failUnless
(
u2
+
u2
==
u2
*
2
==
2
*
u2
,
"u2+u2 == u2*2 == 2*u2"
)
self
.
failUnless
(
u2
+
u2
+
u2
==
u2
*
3
==
3
*
u2
,
"u2+u2+u2 == u2*3 == 3*u2"
)
#self.
assertTrue
(u1 + [] == [] + u1 == u1, "u1 + [] == [] + u1 == u1")
self
.
assertTrue
(
u1
+
[
1
]
==
u2
,
"u1 + [1] == u2"
)
#self.
assertTrue
([-1] + u1 == [-1, 0], "[-1] + u1 == [-1, 0]")
self
.
assertTrue
(
u2
==
u2
*
1
==
1
*
u2
,
"u2 == u2*1 == 1*u2"
)
self
.
assertTrue
(
u2
+
u2
==
u2
*
2
==
2
*
u2
,
"u2+u2 == u2*2 == 2*u2"
)
self
.
assertTrue
(
u2
+
u2
+
u2
==
u2
*
3
==
3
*
u2
,
"u2+u2+u2 == u2*3 == 3*u2"
)
# Test append
...
...
src/ZODB/tests/testZODB.py
View file @
690c699c
...
...
@@ -100,7 +100,7 @@ class ZODBTests(ZODB.tests.util.TestCase):
else
:
raise
else
:
self
.
failUnless
(
not
abort_it
,
'Did not abort duplication'
)
self
.
assertTrue
(
not
abort_it
,
'Did not abort duplication'
)
l1
=
list
(
ob
.
items
())
l1
.
sort
()
l2
=
list
(
ob2
.
items
())
...
...
@@ -560,8 +560,8 @@ class ReadConflictTests(ZODB.tests.util.TestCase):
# but 3.2.3 had a bug wherein it did.
data_conflicts
=
data
.
_p_jar
.
_conflicts
data2_conflicts
=
data2
.
_p_jar
.
_conflicts
self
.
failIf
(
data_conflicts
)
self
.
failIf
(
data2_conflicts
)
# this used to fail
self
.
assertFalse
(
data_conflicts
)
self
.
assertFalse
(
data2_conflicts
)
# this used to fail
# And because of that, we still couldn't commit a change to data2['d']
# in the new transaction.
...
...
src/ZODB/tests/testfsIndex.py
View file @
690c699c
...
...
@@ -68,7 +68,7 @@ class Test(unittest.TestCase):
self
.
assertEqual
(
index
.
get
(
key
),
None
)
self
.
assertEqual
(
index
.
get
(
key
,
''
),
''
)
# self.
failUnless
(len(index._data) > 1)
# self.
assertTrue
(len(index._data) > 1)
def
testUpdate
(
self
):
index
=
self
.
index
...
...
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