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
e098af4d
Commit
e098af4d
authored
Jun 10, 2005
by
Stefan H. Holek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Collector #1798, issue 1: ZopeTestCase no longer tries to
install products that were installed by Zope during startup.
parent
f6ef3658
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
14 deletions
+14
-14
lib/python/OFS/Application.py
lib/python/OFS/Application.py
+0
-9
lib/python/Testing/ZopeTestCase/ZopeLite.py
lib/python/Testing/ZopeTestCase/ZopeLite.py
+9
-3
lib/python/Testing/ZopeTestCase/doc/CHANGES.txt
lib/python/Testing/ZopeTestCase/doc/CHANGES.txt
+2
-0
lib/python/Testing/ZopeTestCase/utils.py
lib/python/Testing/ZopeTestCase/utils.py
+2
-1
lib/python/Testing/ZopeTestCase/zopedoctest/FunctionalDocTest.txt
...on/Testing/ZopeTestCase/zopedoctest/FunctionalDocTest.txt
+1
-1
No files found.
lib/python/OFS/Application.py
View file @
e098af4d
...
@@ -38,9 +38,6 @@ import Folder
...
@@ -38,9 +38,6 @@ import Folder
import
ZDOM
import
ZDOM
from
FindSupport
import
FindSupport
from
FindSupport
import
FindSupport
# Dictionary of installed products, mainly used by ZopeTestCase.
_installedProducts
=
{}
class
Application
(
Globals
.
ApplicationDefaultPermissions
,
class
Application
(
Globals
.
ApplicationDefaultPermissions
,
ZDOM
.
Root
,
Folder
.
Folder
,
ZDOM
.
Root
,
Folder
.
Folder
,
App
.
ProductRegistry
.
ProductRegistry
,
FindSupport
):
App
.
ProductRegistry
.
ProductRegistry
,
FindSupport
):
...
@@ -624,13 +621,7 @@ def install_products(app):
...
@@ -624,13 +621,7 @@ def install_products(app):
# together and do a default initialization.
# together and do a default initialization.
if
done
.
has_key
(
product_name
):
if
done
.
has_key
(
product_name
):
continue
continue
# We need to separately track what has been installed now, and
# what has been installed at a whole. This is because install_products
# should always install everything, but only once every time it's
# called. The _installedProducts dictionary is later used by
# ZopeTestCase to not install products twice.
done
[
product_name
]
=
1
done
[
product_name
]
=
1
_installedProducts
[
product_name
]
=
1
install_product
(
app
,
product_dir
,
product_name
,
meta_types
,
install_product
(
app
,
product_dir
,
product_name
,
meta_types
,
folder_permissions
,
raise_exc
=
debug_mode
)
folder_permissions
,
raise_exc
=
debug_mode
)
...
...
lib/python/Testing/ZopeTestCase/ZopeLite.py
View file @
e098af4d
...
@@ -99,6 +99,8 @@ import OFS.Application
...
@@ -99,6 +99,8 @@ import OFS.Application
import
App.ProductContext
import
App.ProductContext
_write
(
'.'
)
_write
(
'.'
)
_patched
=
False
def
_apply_patches
():
def
_apply_patches
():
# Avoid expensive product import
# Avoid expensive product import
def
null_import_products
():
pass
def
null_import_products
():
pass
...
@@ -116,18 +118,22 @@ def _apply_patches():
...
@@ -116,18 +118,22 @@ def _apply_patches():
def
null_register_help
(
self
,
directory
=
''
,
clear
=
1
,
title_re
=
None
):
pass
def
null_register_help
(
self
,
directory
=
''
,
clear
=
1
,
title_re
=
None
):
pass
App
.
ProductContext
.
ProductContext
.
registerHelp
=
null_register_help
App
.
ProductContext
.
ProductContext
.
registerHelp
=
null_register_help
# Note that we applied the monkey patches
global
_patched
_patched
=
True
# Do not patch a running Zope
# Do not patch a running Zope
if
not
Zope2
.
_began_startup
:
if
not
Zope2
.
_began_startup
:
_apply_patches
()
_apply_patches
()
# Allow test authors to install Zope products into the test environment. Note
# Allow test authors to install Zope products into the test environment. Note
# that installProduct() must be called at module level -- never from tests.
# that installProduct() must be called at module level -- never from tests.
from
OFS.Application
import
get_folder_permissions
,
get_products
,
\
from
OFS.Application
import
get_folder_permissions
,
get_products
,
install_product
install_product
,
_installedProducts
from
OFS.Folder
import
Folder
from
OFS.Folder
import
Folder
import
Products
import
Products
_theApp
=
Zope2
.
app
()
_theApp
=
Zope2
.
app
()
_installedProducts
=
{}
def
hasProduct
(
name
):
def
hasProduct
(
name
):
'''Checks if a product can be found along Products.__path__'''
'''Checks if a product can be found along Products.__path__'''
...
@@ -137,7 +143,7 @@ def installProduct(name, quiet=0):
...
@@ -137,7 +143,7 @@ def installProduct(name, quiet=0):
'''Installs a Zope product.'''
'''Installs a Zope product.'''
start
=
time
.
time
()
start
=
time
.
time
()
meta_types
=
[]
meta_types
=
[]
if
not
_installedProducts
.
has_key
(
name
):
if
_patched
and
not
_installedProducts
.
has_key
(
name
):
for
priority
,
product_name
,
index
,
product_dir
in
get_products
():
for
priority
,
product_name
,
index
,
product_dir
in
get_products
():
if
product_name
==
name
:
if
product_name
==
name
:
if
not
quiet
:
_print
(
'Installing %s ... '
%
product_name
)
if
not
quiet
:
_print
(
'Installing %s ... '
%
product_name
)
...
...
lib/python/Testing/ZopeTestCase/doc/CHANGES.txt
View file @
e098af4d
Unreleased
Unreleased
- Functional.publish() would hang if it got a request_method argument other
- Functional.publish() would hang if it got a request_method argument other
than GET or HEAD while omitting the stdin argument.
than GET or HEAD while omitting the stdin argument.
- installProduct() now becomes a noop if ZopeTestCase did not apply its
patches.
0.9.8 (Zope 2.8 edition)
0.9.8 (Zope 2.8 edition)
- Renamed 'doctest' package to 'zopedoctest' because of name-shadowing
- Renamed 'doctest' package to 'zopedoctest' because of name-shadowing
...
...
lib/python/Testing/ZopeTestCase/utils.py
View file @
e098af4d
...
@@ -97,7 +97,8 @@ def setupSiteErrorLog(app=None):
...
@@ -97,7 +97,8 @@ def setupSiteErrorLog(app=None):
def
importObjectFromFile
(
container
,
filename
,
quiet
=
0
):
def
importObjectFromFile
(
container
,
filename
,
quiet
=
0
):
'''Imports an object from a (.zexp) file into the given container.'''
'''Imports an object from a (.zexp) file into the given container.'''
from
ZopeLite
import
_print
from
ZopeLite
import
_print
,
_patched
quiet
=
quiet
or
not
_patched
start
=
time
.
time
()
start
=
time
.
time
()
if
not
quiet
:
_print
(
"Importing %s ... "
%
os
.
path
.
basename
(
filename
))
if
not
quiet
:
_print
(
"Importing %s ... "
%
os
.
path
.
basename
(
filename
))
container
.
_importObjectFromFile
(
filename
,
verify
=
0
)
container
.
_importObjectFromFile
(
filename
,
verify
=
0
)
...
...
lib/python/Testing/ZopeTestCase/zopedoctest/FunctionalDocTest.txt
View file @
e098af4d
...
@@ -114,7 +114,7 @@ Test Server Error
...
@@ -114,7 +114,7 @@ Test Server Error
... GET /test_folder_1_/script?a=2 HTTP/1.1
... GET /test_folder_1_/script?a=2 HTTP/1.1
... """, handle_errors=False)
... """, handle_errors=False)
HTTP/1.1 500 Internal Server Error
HTTP/1.1 500 Internal Server Error
...Content-Type: text/html...
exceptions.
TypeError...
...Content-Type: text/html...TypeError...
Test Unauthorized
Test Unauthorized
...
...
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