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
13102631
Commit
13102631
authored
Mar 07, 2009
by
Stefan H. Holek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove ancient testrunner.
parent
65c58558
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
275 deletions
+0
-275
src/Testing/ZopeTestCase/runalltests.py
src/Testing/ZopeTestCase/runalltests.py
+0
-52
src/Testing/ZopeTestCase/zopedoctest/runalltests.py
src/Testing/ZopeTestCase/zopedoctest/runalltests.py
+0
-52
src/Testing/ZopeTestCase/ztc_common.py
src/Testing/ZopeTestCase/ztc_common.py
+0
-171
No files found.
src/Testing/ZopeTestCase/runalltests.py
deleted
100644 → 0
View file @
65c58558
##############################################################################
#
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Runs all tests in the current directory [and below]
Execute like:
python runalltests.py [-R]
$Id$
"""
__version__
=
'0.3.1'
import
os
,
sys
if
__name__
==
'__main__'
:
execfile
(
os
.
path
.
join
(
sys
.
path
[
0
],
'framework.py'
))
import
unittest
TestRunner
=
unittest
.
TextTestRunner
suite
=
unittest
.
TestSuite
()
cwd
=
os
.
getcwd
()
def
test_finder
(
recurse
,
dir
,
names
):
if
dir
==
os
.
curdir
or
'__init__.py'
in
names
:
parts
=
[
x
for
x
in
dir
[
len
(
os
.
curdir
):].
split
(
os
.
sep
)
if
x
]
tests
=
[
x
for
x
in
names
if
x
.
startswith
(
'test'
)
and
x
.
endswith
(
'.py'
)]
for
test
in
tests
:
if
test
==
'tests.py'
and
'ZopeTestCase'
in
cwd
:
# Skip tests.py when running ZTC tests
continue
modpath
=
parts
+
[
test
[:
-
3
]]
m
=
__import__
(
'.'
.
join
(
modpath
))
for
part
in
modpath
[
1
:]:
m
=
getattr
(
m
,
part
)
if
hasattr
(
m
,
'test_suite'
):
suite
.
addTest
(
m
.
test_suite
())
if
not
recurse
:
names
[:]
=
[]
if
__name__
==
'__main__'
:
os
.
path
.
walk
(
os
.
curdir
,
test_finder
,
'-R'
in
sys
.
argv
)
TestRunner
().
run
(
suite
)
src/Testing/ZopeTestCase/zopedoctest/runalltests.py
deleted
100644 → 0
View file @
65c58558
##############################################################################
#
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Runs all tests in the current directory [and below]
Execute like:
python runalltests.py [-R]
$Id$
"""
__version__
=
'0.3.1'
import
os
,
sys
if
__name__
==
'__main__'
:
execfile
(
os
.
path
.
join
(
sys
.
path
[
0
],
'framework.py'
))
import
unittest
TestRunner
=
unittest
.
TextTestRunner
suite
=
unittest
.
TestSuite
()
cwd
=
os
.
getcwd
()
def
test_finder
(
recurse
,
dir
,
names
):
if
dir
==
os
.
curdir
or
'__init__.py'
in
names
:
parts
=
[
x
for
x
in
dir
[
len
(
os
.
curdir
):].
split
(
os
.
sep
)
if
x
]
tests
=
[
x
for
x
in
names
if
x
.
startswith
(
'test'
)
and
x
.
endswith
(
'.py'
)]
for
test
in
tests
:
if
test
==
'tests.py'
and
'ZopeTestCase'
in
cwd
:
# Skip tests.py when running ZTC tests
continue
modpath
=
parts
+
[
test
[:
-
3
]]
m
=
__import__
(
'.'
.
join
(
modpath
))
for
part
in
modpath
[
1
:]:
m
=
getattr
(
m
,
part
)
if
hasattr
(
m
,
'test_suite'
):
suite
.
addTest
(
m
.
test_suite
())
if
not
recurse
:
names
[:]
=
[]
if
__name__
==
'__main__'
:
os
.
path
.
walk
(
os
.
curdir
,
test_finder
,
'-R'
in
sys
.
argv
)
TestRunner
().
run
(
suite
)
src/Testing/ZopeTestCase/ztc_common.py
deleted
100644 → 0
View file @
65c58558
##############################################################################
#
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""ztc_common.py
This file must be called from framework.py like so
execfile(os.path.join(os.path.dirname(Testing.__file__),
'ZopeTestCase', 'ztc_common.py'))
$Id$
"""
# Overwrites the default framework() method to expose the
# TestRunner parameters
#
def
framework
(
stream
=
sys
.
stderr
,
descriptions
=
1
,
verbosity
=
1
):
if
__name__
!=
'__main__'
:
return
if
len
(
sys
.
argv
)
>
1
:
arg
=
sys
.
argv
[
1
]
sys
.
exit
(
globals
()[
arg
]()
and
1
or
0
)
result
=
TestRunner
(
stream
,
descriptions
,
verbosity
).
run
(
test_suite
())
sys
.
exit
(
len
(
result
.
errors
)
+
len
(
result
.
failures
))
# Configures the Zope environment
#
class
Configurator
:
def
__init__
(
self
):
'''Sets up the configurator.'''
self
.
cwd
=
self
.
realpath
(
os
.
getcwd
())
self
.
software_home
=
self
.
realpath
(
os
.
environ
.
get
(
'SOFTWARE_HOME'
,
''
))
self
.
instance_home
=
self
.
realpath
(
globals
()[
'__INSTANCE_HOME'
])
self
.
zeo_instance_home
=
self
.
realpath
(
os
.
environ
.
get
(
'ZEO_INSTANCE_HOME'
,
''
))
self
.
zope_config
=
self
.
realpath
(
os
.
environ
.
get
(
'ZOPE_CONFIG'
,
''
))
def
run
(
self
):
'''Runs the configurator.'''
if
self
.
zope_config
:
# Don't configure anything if people use the ZOPE_CONFIG patch
return
if
self
.
zeo_instance_home
:
self
.
setup_zeo_instance_home
()
else
:
if
self
.
instance_home
:
self
.
setup_instance_home
()
else
:
self
.
detect_and_setup_instance_home
()
self
.
setup_custom_zodb
()
def
setup_zeo_instance_home
(
self
):
'''If ZEO_INSTANCE_HOME has been given, assume a ZEO setup and use the
instance's custom_zodb.py to connect to a running ZEO server.'''
if
os
.
path
.
isdir
(
os
.
path
.
join
(
self
.
zeo_instance_home
,
'Products'
)):
if
os
.
path
.
exists
(
os
.
path
.
join
(
self
.
zeo_instance_home
,
'custom_zodb.py'
)):
self
.
add_instance
(
self
.
zeo_instance_home
)
if
self
.
getconfig
(
'testinghome'
):
self
.
setconfig
(
testinghome
=
self
.
zeo_instance_home
)
self
.
setconfig
(
instancehome
=
self
.
zeo_instance_home
)
else
:
os
.
environ
[
'INSTANCE_HOME'
]
=
INSTANCE_HOME
=
self
.
zeo_instance_home
self
.
setconfig
(
instancehome
=
self
.
zeo_instance_home
)
else
:
print
'Unable to locate custom_zodb.py in %s.'
%
self
.
zeo_instance_home
sys
.
exit
(
1
)
else
:
print
'Unable to locate Products directory in %s.'
%
self
.
zeo_instance_home
sys
.
exit
(
1
)
def
setup_instance_home
(
self
):
'''If INSTANCE_HOME has been given, add the instance's Products
and lib/python directories to the appropriate paths.'''
if
os
.
path
.
isdir
(
os
.
path
.
join
(
self
.
instance_home
,
'Products'
)):
self
.
add_instance
(
self
.
instance_home
)
if
self
.
getconfig
(
'testinghome'
):
self
.
setconfig
(
instancehome
=
self
.
instance_home
)
else
:
print
'Unable to locate Products directory in %s.'
%
self
.
instance_home
sys
.
exit
(
1
)
def
detect_and_setup_instance_home
(
self
):
'''If INSTANCE_HOME has not been given, try to detect whether we run
in an instance home installation by walking up from cwd until we
find a 'Products' dir.'''
if
not
self
.
cwd
.
startswith
(
self
.
software_home
):
p
=
d
=
self
.
cwd
while
d
:
if
os
.
path
.
isdir
(
os
.
path
.
join
(
p
,
'Products'
)):
self
.
add_instance
(
p
)
if
self
.
getconfig
(
'testinghome'
):
self
.
setconfig
(
instancehome
=
p
)
break
p
,
d
=
os
.
path
.
split
(
p
)
else
:
print
'Unable to locate Products directory.'
,
print
'You might need to set INSTANCE_HOME.'
sys
.
exit
(
1
)
def
setup_custom_zodb
(
self
):
'''If there is a custom_zodb.py file in the tests dir, use it.
Note that the instance has already been set at this point
so redirecting INSTANCE_HOME should be safe.'''
if
os
.
path
.
exists
(
os
.
path
.
join
(
self
.
cwd
,
'custom_zodb.py'
)):
if
self
.
getconfig
(
'testinghome'
):
self
.
setconfig
(
testinghome
=
self
.
cwd
)
else
:
os
.
environ
[
'INSTANCE_HOME'
]
=
INSTANCE_HOME
=
self
.
cwd
self
.
setconfig
(
instancehome
=
self
.
cwd
)
def
add_instance
(
self
,
p
):
'''Adds an INSTANCE_HOME directory to Products.__path__ and sys.path.'''
import
Products
products
=
os
.
path
.
join
(
p
,
'Products'
)
if
os
.
path
.
isdir
(
products
)
and
products
not
in
Products
.
__path__
:
Products
.
__path__
.
insert
(
0
,
products
)
libpython
=
os
.
path
.
join
(
p
,
'lib'
,
'python'
)
if
os
.
path
.
isdir
(
libpython
)
and
libpython
not
in
sys
.
path
:
sys
.
path
.
insert
(
0
,
libpython
)
def
getconfig
(
self
,
key
):
'''Reads a value from Zope configuration.'''
try
:
import
App.config
except
ImportError
:
pass
else
:
config
=
App
.
config
.
getConfiguration
()
return
getattr
(
config
,
key
,
None
)
def
setconfig
(
self
,
**
kw
):
'''Updates Zope configuration'''
try
:
import
App.config
except
ImportError
:
pass
else
:
config
=
App
.
config
.
getConfiguration
()
for
key
,
value
in
kw
.
items
():
setattr
(
config
,
key
,
value
)
App
.
config
.
setConfiguration
(
config
)
def
realpath
(
self
,
path
):
try
:
from
os.path
import
realpath
except
ImportError
:
try
:
from
App.Common
import
realpath
except
ImportError
:
realpath
=
os
.
path
.
abspath
if
not
path
:
return
path
return
realpath
(
path
)
if
__name__
==
'__main__'
:
Configurator
().
run
()
del
Configurator
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