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
0d7f3cea
Commit
0d7f3cea
authored
Sep 08, 2006
by
Stefan H. Holek
Browse files
Options
Browse Files
Download
Plain Diff
Merged r69818:70069 from 2.10 branch.
Layer fix and version bump.
parents
f852d30a
91537bfa
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
162 additions
and
6 deletions
+162
-6
lib/python/Testing/ZopeTestCase/doc/CHANGES.txt
lib/python/Testing/ZopeTestCase/doc/CHANGES.txt
+2
-0
lib/python/Testing/ZopeTestCase/doc/VERSION.txt
lib/python/Testing/ZopeTestCase/doc/VERSION.txt
+1
-1
lib/python/Testing/ZopeTestCase/runalltests.py
lib/python/Testing/ZopeTestCase/runalltests.py
+4
-0
lib/python/Testing/ZopeTestCase/tests.py
lib/python/Testing/ZopeTestCase/tests.py
+38
-0
lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
+13
-5
lib/python/Testing/ZopeTestCase/zopedoctest/layerextraction.txt
...thon/Testing/ZopeTestCase/zopedoctest/layerextraction.txt
+6
-0
lib/python/Testing/ZopeTestCase/zopedoctest/runalltests.py
lib/python/Testing/ZopeTestCase/zopedoctest/runalltests.py
+4
-0
lib/python/Testing/ZopeTestCase/zopedoctest/testLayerExtraction.py
...n/Testing/ZopeTestCase/zopedoctest/testLayerExtraction.py
+58
-0
lib/python/Testing/ZopeTestCase/zopedoctest/tests.py
lib/python/Testing/ZopeTestCase/zopedoctest/tests.py
+36
-0
No files found.
lib/python/Testing/ZopeTestCase/doc/CHANGES.txt
View file @
0d7f3cea
...
...
@@ -12,6 +12,8 @@
- Added placeless.py for Z3-style setup. Thanks to Whit Morriss.
- Fixed functional.http() to only pass the request body (no headers) to
publish_module(). Thanks to Andreas Zeidler.
- Fixed doctestsuite factory to copy layers from test_class to the suite.
Thanks to Whit Morris.
0.9.8 (Zope 2.8 edition)
- Renamed 'doctest' package to 'zopedoctest' because of name-shadowing
...
...
lib/python/Testing/ZopeTestCase/doc/VERSION.txt
View file @
0d7f3cea
ZopeTestCase 0.9.
8
ZopeTestCase 0.9.
9
lib/python/Testing/ZopeTestCase/runalltests.py
View file @
0d7f3cea
...
...
@@ -27,12 +27,16 @@ if __name__ == '__main__':
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
:]:
...
...
lib/python/Testing/ZopeTestCase/tests.py
0 → 100644
View file @
0d7f3cea
##############################################################################
#
# Copyright (c) 2006 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.
#
##############################################################################
"""Test runner that works with zope.testing.testrunner
$Id$
"""
import
unittest
import
os
import
Testing.ZopeTestCase
suite
=
unittest
.
TestSuite
()
names
=
os
.
listdir
(
os
.
path
.
dirname
(
__file__
))
tests
=
[
x
[:
-
3
]
for
x
in
names
if
x
.
startswith
(
'test'
)
and
x
.
endswith
(
'.py'
)
and
x
!=
'tests.py'
# Don't run this module as part of the Zope2 suite
and
x
!=
'testWebserver.py'
]
for
test
in
tests
:
m
=
__import__
(
'Testing.ZopeTestCase.%s'
%
test
)
m
=
getattr
(
Testing
.
ZopeTestCase
,
test
)
if
hasattr
(
m
,
'test_suite'
):
suite
.
addTest
(
m
.
test_suite
())
def
test_suite
():
return
suite
lib/python/Testing/ZopeTestCase/zopedoctest/functional.py
View file @
0d7f3cea
...
...
@@ -204,15 +204,22 @@ class ZopeSuiteFactory:
def __init__(self, *args, **kw):
self._args = args
self._kw = kw
self._layer = None
self.setup_globs()
self.setup_test_class()
self.setup_optionflags()
def doctestsuite(self):
return doctest.DocTestSuite(*self._args, **self._kw)
suite = doctest.DocTestSuite(*self._args, **self._kw)
if self._layer is not None:
suite.layer = self._layer
return suite
def docfilesuite(self):
return doctest.DocFileSuite(*self._args, **self._kw)
suite = doctest.DocFileSuite(*self._args, **self._kw)
if self._layer is not None:
suite.layer = self._layer
return suite
def setup_globs(self):
globs = self._kw.setdefault('
globs
', {})
...
...
@@ -228,6 +235,10 @@ class ZopeSuiteFactory:
if '
test_class
' in self._kw:
del self._kw['
test_class
']
# Fix for http://zope.org/Collectors/Zope/2178
if hasattr(test_class, '
layer
'):
self._layer = test_class.layer
# If the test_class does not have a runTest method, we add
# a dummy attribute so that TestCase construction works.
if not hasattr(test_class, '
runTest
'):
...
...
@@ -307,18 +318,15 @@ def ZopeDocTestSuite(module=None, **kw):
module
=
doctest
.
_normalize_module
(
module
)
return
ZopeSuiteFactory
(
module
,
**
kw
).
doctestsuite
()
def
ZopeDocFileSuite
(
*
paths
,
**
kw
):
if
kw
.
get
(
'module_relative'
,
True
):
kw
[
'package'
]
=
doctest
.
_normalize_module
(
kw
.
get
(
'package'
))
return
ZopeSuiteFactory
(
*
paths
,
**
kw
).
docfilesuite
()
def
FunctionalDocTestSuite
(
module
=
None
,
**
kw
):
module
=
doctest
.
_normalize_module
(
module
)
return
FunctionalSuiteFactory
(
module
,
**
kw
).
doctestsuite
()
def
FunctionalDocFileSuite
(
*
paths
,
**
kw
):
if
kw
.
get
(
'module_relative'
,
True
):
kw
[
'package'
]
=
doctest
.
_normalize_module
(
kw
.
get
(
'package'
))
...
...
lib/python/Testing/ZopeTestCase/zopedoctest/layerextraction.txt
0 → 100644
View file @
0d7f3cea
If the layer is extracted properly, we should see the following
variable
>>> getattr(self.app, 'LAYER_EXTRACTED', False)
True
lib/python/Testing/ZopeTestCase/zopedoctest/runalltests.py
View file @
0d7f3cea
...
...
@@ -27,12 +27,16 @@ if __name__ == '__main__':
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
:]:
...
...
lib/python/Testing/ZopeTestCase/zopedoctest/testLayerExtraction.py
0 → 100644
View file @
0d7f3cea
##############################################################################
#
# Copyright (c) 2006 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.
#
##############################################################################
"""Test layer extraction feature
$Id$
"""
from
unittest
import
TestSuite
from
Testing
import
ZopeTestCase
from
Testing.ZopeTestCase
import
ZopeDocFileSuite
from
Testing.ZopeTestCase
import
ZopeDocTestSuite
from
Testing.ZopeTestCase
import
transaction
class
TestLayer
:
"""
If the layer is extracted properly, we should see the following
variable
>>> getattr(self.app, 'LAYER_EXTRACTED', False)
True
"""
@
classmethod
def
setUp
(
cls
):
app
=
ZopeTestCase
.
app
()
app
.
LAYER_EXTRACTED
=
True
transaction
.
commit
()
ZopeTestCase
.
close
(
app
)
@
classmethod
def
tearDown
(
cls
):
app
=
ZopeTestCase
.
app
()
delattr
(
app
,
'LAYER_EXTRACTED'
)
transaction
.
commit
()
ZopeTestCase
.
close
(
app
)
class
TestCase
(
ZopeTestCase
.
ZopeTestCase
):
layer
=
TestLayer
def
test_suite
():
return
TestSuite
((
ZopeDocTestSuite
(
test_class
=
TestCase
),
ZopeDocFileSuite
(
'layerextraction.txt'
,
test_class
=
TestCase
),
))
lib/python/Testing/ZopeTestCase/zopedoctest/tests.py
0 → 100644
View file @
0d7f3cea
##############################################################################
#
# Copyright (c) 2006 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.
#
##############################################################################
"""Test runner that works with zope.testing.testrunner
$Id$
"""
import
unittest
import
os
import
Testing.ZopeTestCase.zopedoctest
suite
=
unittest
.
TestSuite
()
names
=
os
.
listdir
(
os
.
path
.
dirname
(
__file__
))
tests
=
[
x
[:
-
3
]
for
x
in
names
if
x
.
startswith
(
'test'
)
and
x
.
endswith
(
'.py'
)
and
x
!=
'tests.py'
]
for
test
in
tests
:
m
=
__import__
(
'Testing.ZopeTestCase.zopedoctest.%s'
%
test
)
m
=
getattr
(
Testing
.
ZopeTestCase
.
zopedoctest
,
test
)
if
hasattr
(
m
,
'test_suite'
):
suite
.
addTest
(
m
.
test_suite
())
def
test_suite
():
return
suite
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