Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Kirill Smelkov
Zope
Commits
ad215c3a
Commit
ad215c3a
authored
Jul 31, 2010
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove utterly outdated regression tests
parent
6a406941
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
0 additions
and
2609 deletions
+0
-2609
src/Products/ZCatalog/regressiontests/keywords.py
src/Products/ZCatalog/regressiontests/keywords.py
+0
-46
src/Products/ZCatalog/regressiontests/loadmail.py
src/Products/ZCatalog/regressiontests/loadmail.py
+0
-755
src/Products/ZCatalog/regressiontests/regressionCatalog.py
src/Products/ZCatalog/regressiontests/regressionCatalog.py
+0
-710
src/Products/ZCatalog/regressiontests/regressionCatalogTiming.py
...ducts/ZCatalog/regressiontests/regressionCatalogTiming.py
+0
-246
src/Products/ZCatalog/regressiontests/regressionUnicode.py
src/Products/ZCatalog/regressiontests/regressionUnicode.py
+0
-122
src/Products/ZCatalog/regressiontests/unittest_patched.py
src/Products/ZCatalog/regressiontests/unittest_patched.py
+0
-730
No files found.
src/Products/ZCatalog/regressiontests/keywords.py
deleted
100644 → 0
View file @
6a406941
import
rfc822
,
mailbox
,
cPickle
,
string
class
Keywords
:
""" stupid class to read a list of rfc822 messages and extract
all words from the subject header. We use this class for testing
purposes only
"""
def
__init__
(
self
):
self
.
kw
=
[]
def
build
(
self
,
mbox
,
limit
):
mb
=
mailbox
.
UnixMailbox
(
open
(
mbox
))
msg
=
mb
.
next
()
while
msg
and
len
(
self
.
kw
)
<
limit
:
sub
=
msg
.
dict
.
get
(
"subject"
,
""
).
split
(
' '
)
for
f
in
sub
:
ok
=
1
for
c
in
f
:
if
not
c
in
string
.
letters
:
ok
=
0
if
ok
==
1
and
not
f
in
self
.
kw
:
self
.
kw
.
append
(
f
)
msg
=
mb
.
next
()
P
=
cPickle
.
Pickler
(
open
(
'data/keywords'
,
'w'
))
P
.
dump
(
self
.
kw
)
def
reload
(
self
):
P
=
cPickle
.
Unpickler
(
open
(
'data/keywords'
,
'r'
))
self
.
kw
=
P
.
load
()
def
keywords
(
self
):
return
self
.
kw
if
__name__
==
"__main__"
:
k
=
Keywords
()
k
.
build
(
"/home/andreas/zope.mbox"
,
1000
)
src/Products/ZCatalog/regressiontests/loadmail.py
deleted
100644 → 0
View file @
6a406941
This diff is collapsed.
Click to expand it.
src/Products/ZCatalog/regressiontests/regressionCatalog.py
deleted
100755 → 0
View file @
6a406941
This diff is collapsed.
Click to expand it.
src/Products/ZCatalog/regressiontests/regressionCatalogTiming.py
deleted
100644 → 0
View file @
6a406941
# XXX: Products.PluginIndexes.TextIndex no longer exists
import
os
,
sys
sys
.
path
.
insert
(
0
,
'.'
)
try
:
import
Testing
os
.
environ
[
'SOFTWARE_HOME'
]
=
os
.
environ
.
get
(
'SOFTWARE_HOME'
,
'.'
)
except
ImportError
:
sys
.
path
[
0
]
=
'../../..'
import
Testing
os
.
environ
[
'SOFTWARE_HOME'
]
=
'../../..'
os
.
environ
[
'INSTANCE_HOME'
]
=
os
.
environ
.
get
(
'INSTANCE_HOME'
,
os
.
path
.
join
(
os
.
environ
[
'SOFTWARE_HOME'
],
'..'
,
'..'
)
)
os
.
environ
[
'STUPID_LOG_FILE'
]
=
os
.
path
.
join
(
os
.
environ
[
'INSTANCE_HOME'
],
'var'
,
'debug.log'
)
here
=
os
.
getcwd
()
import
Zope2
import
mailbox
,
time
,
httplib
from
string
import
strip
,
find
,
split
,
lower
,
atoi
,
join
from
urllib
import
quote
from
Products.ZCatalog
import
ZCatalog
from
unittest
import
TestCase
,
TestSuite
,
JUnitTextTestRunner
,
\
VerboseTextTestRunner
,
makeSuite
import
transaction
from
Products.PluginIndexes.FieldIndex.FieldIndex
import
FieldIndex
#from Products.PluginIndexes.TextIndex.TextIndex import TextIndex
#from Products.PluginIndexes.TextIndex.Lexicon import Lexicon
from
Products.PluginIndexes.KeywordIndex.KeywordIndex
import
KeywordIndex
from
Testing.makerequest
import
makerequest
TextTestRunner
=
VerboseTextTestRunner
class
TestTimeIndex
(
TestCase
):
def
setUp
(
self
):
self
.
app
=
makerequest
(
Zope2
.
app
())
try
:
self
.
app
.
_delObject
(
'catalogtest'
)
except
AttributeError
:
pass
self
.
app
.
manage_addFolder
(
'catalogtest'
)
zcatalog
=
ZCatalog
.
ZCatalog
(
'catalog'
,
'a catalog'
)
self
.
app
.
catalogtest
.
_setObject
(
'catalog'
,
zcatalog
)
c
=
self
.
app
.
catalogtest
.
catalog
for
x
in
(
'title'
,
'to'
,
'from'
,
'date'
,
'raw'
):
try
:
c
.
manage_delIndex
([
x
])
except
:
pass
c
.
manage_addIndex
(
'title'
,
'TextIndex'
)
c
.
manage_addIndex
(
'to'
,
'TextIndex'
)
c
.
manage_addIndex
(
'from'
,
'TextIndex'
)
c
.
manage_addIndex
(
'date'
,
'FieldIndex'
)
c
.
manage_addIndex
(
'raw'
,
'TextIndex'
)
def
tearDown
(
self
):
try
:
self
.
app
.
_delObject
(
'catalogtest'
)
except
AttributeError
:
pass
try
:
self
.
app
.
_p_jar
.
_db
.
pack
()
self
.
app
.
_p_jar
.
close
()
except
AttributeError
:
pass
self
.
app
=
None
del
self
.
app
def
checkTimeBulkIndex
(
self
):
print
c
=
self
.
app
.
catalogtest
.
catalog
t
=
time
.
time
()
loadmail
(
self
.
app
.
catalogtest
,
'zopemail'
,
os
.
path
.
join
(
here
,
'zope.mbox'
),
500
)
transaction
.
commit
()
loadtime
=
time
.
time
()
-
t
out
(
"loading data took %s seconds.. "
%
loadtime
)
t
=
time
.
time
()
req
=
self
.
app
.
REQUEST
parents
=
[
self
.
app
.
catalogtest
.
catalog
,
self
.
app
.
catalogtest
,
self
.
app
]
req
[
'PARENTS'
]
=
parents
rsp
=
self
.
app
.
REQUEST
.
RESPONSE
url1
=
''
c
.
manage_catalogFoundItems
(
req
,
rsp
,
url1
,
url1
,
obj_metatypes
=
[
'DTML Document'
])
indextime
=
time
.
time
()
-
t
out
(
"bulk index took %s seconds.. "
%
indextime
)
out
(
"total time for load and index was %s seconds.. "
%
(
loadtime
+
indextime
))
def
checkTimeIncrementalIndexAndQuery
(
self
):
print
c
=
self
.
app
.
catalogtest
.
catalog
t
=
time
.
time
()
max
=
500
m
=
loadmail
(
self
.
app
.
catalogtest
,
'zopemail'
,
os
.
path
.
join
(
here
,
'zope.mbox'
),
max
,
c
)
transaction
.
commit
()
total
=
time
.
time
()
-
t
out
(
"total time for load and index was %s seconds.. "
%
total
)
t
=
time
.
time
()
rs
=
c
()
# empty query should return all
assert
len
(
rs
)
==
max
,
len
(
rs
)
dates
=
m
[
'date'
]
froms
=
m
[
'from'
]
tos
=
m
[
'to'
]
titles
=
m
[
'title'
]
assert
len
(
c
({
'date'
:
'foobarfoo'
}))
==
0
# should return no results
for
x
in
dates
:
assert
len
(
c
({
'date'
:
x
}))
==
1
# each date should be fieldindexed
assert
len
(
c
({
'from'
:
'a'
}))
==
0
# should be caught by splitter
assert
len
(
c
({
'raw'
:
'chris'
}))
!=
0
assert
len
(
c
({
'raw'
:
'gghdjkasjdsda'
}))
==
0
assert
c
({
'PrincipiaSearchSource'
:
'the*'
})
def
checkTimeSubcommit
(
self
):
print
for
x
in
(
None
,
100
,
500
,
1000
,
10000
):
out
(
"testing subcommit at theshhold of %s"
%
x
)
if
x
is
not
None
:
self
.
setUp
()
c
=
self
.
app
.
catalogtest
.
catalog
c
.
threshold
=
x
transaction
.
commit
()
t
=
time
.
time
()
loadmail
(
self
.
app
.
catalogtest
,
'zopemail'
,
os
.
path
.
join
(
here
,
'zope.mbox'
),
500
,
c
)
transaction
.
commit
()
total
=
time
.
time
()
-
t
out
(
"total time with subcommit thresh %s was %s seconds.. "
%
(
x
,
total
))
self
.
tearDown
()
# utility
def
loadmail
(
folder
,
name
,
mbox
,
max
=
None
,
catalog
=
None
):
"""
creates a folder inside object 'folder' named 'name', opens
filename 'mbox' and adds 'max' mail messages as DTML documents to
the ZODB inside the folder named 'name'. If 'catalog' (which
should be a ZCatalog object) is passed in, call catalog_object on it
with the document while we're iterating. If 'max' is not None,
only do 'max' messages, else do all messages in the mbox archive.
"""
m
=
{
'date'
:[],
'from'
:[],
'to'
:[],
'title'
:[]}
folder
.
manage_addFolder
(
name
)
folder
=
getattr
(
folder
,
name
)
mb
=
mailbox
.
UnixMailbox
(
open
(
mbox
))
i
=
0
every
=
100
message
=
mb
.
next
()
while
message
:
part
=
`i/every * 100`
try
:
dest
=
getattr
(
folder
,
part
)
except
AttributeError
:
folder
.
manage_addFolder
(
part
)
dest
=
getattr
(
folder
,
part
)
dest
.
manage_addDTMLDocument
(
str
(
i
),
file
=
message
.
fp
.
read
())
doc
=
getattr
(
dest
,
str
(
i
))
i
=
i
+
1
for
h
in
message
.
headers
:
h
=
strip
(
h
)
l
=
find
(
h
,
':'
)
if
l
<=
0
:
continue
name
=
lower
(
h
[:
l
])
if
name
==
'subject'
:
name
=
'title'
h
=
strip
(
h
[
l
+
1
:])
type
=
'string'
if
0
and
name
==
'date'
:
type
=
'date'
elif
0
:
try
:
atoi
(
h
)
except
:
pass
else
:
type
=
int
if
name
==
'title'
:
doc
.
manage_changeProperties
(
title
=
h
)
m
[
name
].
append
(
h
)
elif
name
in
(
'to'
,
'from'
,
'date'
):
try
:
doc
.
manage_addProperty
(
name
,
h
,
type
)
except
:
pass
m
[
name
].
append
(
h
)
if
catalog
:
path
=
join
(
doc
.
getPhysicalPath
(),
'/'
)
catalog
.
catalog_object
(
doc
,
path
)
if
max
is
not
None
:
if
i
>=
max
:
break
message
=
mb
.
next
()
return
m
def
out
(
s
):
print
" %s"
%
s
def
test_suite
():
s1
=
makeSuite
(
TestTimeIndex
,
'check'
)
testsuite
=
TestSuite
((
s1
,))
return
testsuite
def
main
():
mb
=
os
.
path
.
join
(
here
,
'zope.mbox'
)
if
not
os
.
path
.
isfile
(
mb
):
print
"do you want to get the zope.mbox file from lists.zope.org?"
print
"it's required for testing (98MB, ~ 30mins on fast conn)"
print
"it's also available at korak:/home/chrism/zope.mbox"
print
"-- type 'Y' or 'N'"
a
=
raw_input
()
if
lower
(
a
[:
1
])
==
'y'
:
server
=
'lists.zope.org:80'
method
=
'/pipermail/zope.mbox/zope.mbox'
h
=
httplib
.
HTTP
(
server
)
h
.
putrequest
(
'GET'
,
method
)
h
.
putheader
(
'User-Agent'
,
'silly'
)
h
.
putheader
(
'Accept'
,
'text/html'
)
h
.
putheader
(
'Accept'
,
'text/plain'
)
h
.
putheader
(
'Host'
,
server
)
h
.
endheaders
()
errcode
,
errmsg
,
headers
=
h
.
getreply
()
if
errcode
!=
200
:
f
=
h
.
getfile
()
data
=
f
.
read
()
print
data
class
HTTPRequestError
(
Exception
):
pass
raise
HTTPRequestError
,
"Error reading from host %s"
%
server
f
=
h
.
getfile
()
out
=
open
(
mb
,
'w'
)
print
"this is going to take a while..."
print
"downloading mbox from %s"
%
server
while
1
:
l
=
f
.
readline
()
if
not
l
:
break
out
.
write
(
l
)
alltests
=
test_suite
()
runner
=
TextTestRunner
()
runner
.
run
(
alltests
)
def
debug
():
test_suite
().
debug
()
if
__name__
==
'__main__'
:
if
len
(
sys
.
argv
)
>
1
:
globals
()[
sys
.
argv
[
1
]]()
else
:
main
()
src/Products/ZCatalog/regressiontests/regressionUnicode.py
deleted
100644 → 0
View file @
6a406941
# XXX: Products.PluginIndexes.TextIndex no longer exists
import
os
,
sys
import
unittest
import
Zope2
from
Products.ZCatalog.ZCatalog
import
ZCatalog
#from Products.PluginIndexes.TextIndex import Splitter
# This patch pretends the ZCatalog is using the Unicode Splitter
# but by default the ZCatalog/TextIndexes uses the standard
# non-unicode-aware ZopeSplitter
#Splitter.availableSplitters = [ ("UnicodeSplitter" , "Unicode-aware splitter")]
#Splitter.splitterNames = [ "UnicodeSplitter" ]
class
TO
:
def
__init__
(
self
,
txt
,
kw
=
''
):
self
.
text
=
txt
self
.
kw
=
kw
class
UnicodeTextIndexCatalogTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
cat
=
ZCatalog
(
"catalog"
)
self
.
cat
.
addIndex
(
'text'
,
"TextIndex"
)
self
.
cat
.
addColumn
(
'text'
)
self
.
cat
.
addIndex
(
'kw'
,
'KeywordIndex'
)
self
.
cat
.
addColumn
(
'kw'
)
t1
=
TO
(
'the quick brown fox jumps over the lazy dog'
,[
'quick'
,
'fox'
])
t2
=
TO
(
'i am the nice alien from the future'
,[
'alien'
,
'future'
])
t3
=
TO
(
'i am a brown fox dancing with a future alien'
,[
'zerstrt'
,
'knnten'
])
t4
=
TO
(
'i am a brown '
+
unicode
(
'fox'
)
+
' dancing with a future alien'
,[])
t5
=
TO
(
"""
Die USA und Grobritannien knnen nach der Zerstrung der
afghanischen Luftabwehr nun rund um die Uhr Angriffe fliegen. Das gab
Verteidigungsminister Donald Rumsfeld bekannt. Bei den dreitgigen Angriffen
seien auch bis auf einen alle Flugpltze der Taliban zerstrt worden. Rumsfeld
erklrte weiter, er knne die Berichte nicht besttigen, wonach bei den
amerikanischen Angriffen vier afghanische Mitarbeiter einer von den UN
finanzierten Hilfsorganisation gettet wurden. Diese knnten auch durch
Gegenfeuer der Taliban gettet worden sein.
"""
,[
unicode
(
'dreitgigen'
,
'latin1'
),
'zerstrt'
])
self
.
cat
.
catalog_object
(
t1
,
"o1"
)
self
.
cat
.
catalog_object
(
t2
,
"o2"
)
self
.
cat
.
catalog_object
(
t3
,
"o3"
)
self
.
cat
.
catalog_object
(
t4
,
"o4"
)
self
.
cat
.
catalog_object
(
t5
,
"o5"
)
self
.
tests
=
[(
'quick'
,(
'o1'
,)),
(
'fox'
,(
'o1'
,
'o3'
,
'o4'
)),
(
'afghanischen'
,
(
'o5'
,)),
(
'dreitgigen'
,(
'o5'
,))
]
self
.
kw_tests
=
[
(
'quick'
,(
'o1'
,)
),
(
'zerstrt'
,(
'o3'
,
'o5'
)),
(
'dreitgigen'
,(
'o5'
,))
]
def
_doTests
(
self
,
tests
,
field
,
test_unicode
=
0
):
for
q
,
objs
in
tests
:
if
test_unicode
:
res
=
self
.
cat
.
searchResults
({
field
:{
'query'
:
unicode
(
q
,
'latin1'
)}})
else
:
res
=
self
.
cat
.
searchResults
({
field
:{
'query'
:
q
}})
got
=
[
x
.
getURL
()
for
x
in
res
]
got
.
sort
()
expected
=
list
(
objs
)
expected
.
sort
()
assert
got
==
expected
,
\
"%s: got: %s, expected: %s"
%
(
q
,
got
,
expected
)
def
testAsciiQuery
(
self
):
""" ascii query textindex """
self
.
_doTests
(
self
.
tests
,
'text'
,
test_unicode
=
0
)
def
testUnicodeQuery
(
self
):
""" unicode query textindex """
self
.
_doTests
(
self
.
tests
,
'text'
,
test_unicode
=
1
)
# The Tests for KeywordIndexes are disabled at this time
# because of a strange behaviour of OOBTrees containing
# mixed strings and unicode strings
#
#
# def testAsciiKeywords(self):
# """ ascii query keyword index """
# self._doTests(self.kw_tests, 'kw', test_unicode=0)
#
#
# def testUnicodeKeywords(self):
# """ ascii query keyword index """
# self._doTests(self.kw_tests, 'kw', test_unicode=1)
def
test_suite
():
return
unittest
.
makeSuite
(
UnicodeTextIndexCatalogTest
)
def
main
():
unittest
.
TextTestRunner
().
run
(
test_suite
())
if
__name__
==
'__main__'
:
main
()
src/Products/ZCatalog/regressiontests/unittest_patched.py
deleted
100755 → 0
View file @
6a406941
This diff is collapsed.
Click to expand it.
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