Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Léo-Paul Géneau
erp5
Commits
7691ed2b
Commit
7691ed2b
authored
Sep 05, 2014
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runUnitTest: remove obsolete code for "static" files now that everything has moved to ZODB
parent
f968bb32
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
67 deletions
+18
-67
product/ERP5/tests/testBusinessTemplate.py
product/ERP5/tests/testBusinessTemplate.py
+15
-0
product/ERP5Type/tests/custom_zodb.py
product/ERP5Type/tests/custom_zodb.py
+0
-34
product/ERP5Type/tests/runUnitTest.py
product/ERP5Type/tests/runUnitTest.py
+3
-33
No files found.
product/ERP5/tests/testBusinessTemplate.py
View file @
7691ed2b
...
...
@@ -62,6 +62,8 @@ from Products.ERP5.Document.Organisation import Organisation
from
Products.ERP5Type.Accessor.Constant
import
PropertyGetter
as
ConstantGetter
from
ZODB.broken
import
Broken
instance_home
=
os
.
environ
[
'INSTANCE_HOME'
]
class
MockBrokenOrganisation
(
Organisation
,
Broken
):
meta_type
=
'ERP5 Mock Broken Organisation'
portal_type
=
'Mock Broken Organisation'
...
...
@@ -113,8 +115,21 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
content_type_registry
.
removePredicate
(
'any'
)
self
.
commit
()
# Create old static dirs for migration tests
self
.
rmdir_list
=
[]
for
d
in
"Constraint"
,
"Document"
,
"Extensions"
,
"PropertySheet"
:
d
=
os
.
path
.
join
(
instance_home
,
d
)
try
:
os
.
mkdir
(
d
)
except
OSError
:
continue
self
.
rmdir_list
.
append
(
d
)
def
beforeTearDown
(
self
):
"""Remove objects created in tests."""
for
d
in
getattr
(
self
,
"rmdir_list"
,
()):
shutil
.
rmtree
(
d
)
pw
=
self
.
getWorkflowTool
()
cbt
=
pw
.
_chains_by_type
...
...
product/ERP5Type/tests/custom_zodb.py
View file @
7691ed2b
import
errno
import
os
import
subprocess
import
shutil
import
signal
import
socket
import
sys
import
glob
import
threading
import
time
import
ZODB
from
asyncore
import
socket_map
from
ZODB.DemoStorage
import
DemoStorage
from
ZODB.FileStorage
import
FileStorage
from
Products.ERP5Type.tests.utils
import
getMySQLArguments
,
instance_random
from
Products.ERP5Type.tests.runUnitTest
import
static_dir_list
,
WIN
def
_print
(
message
):
sys
.
stderr
.
write
(
message
+
"
\
n
"
)
...
...
@@ -55,14 +48,6 @@ if save_mysql:
_print
(
'Dumping MySQL database with %s ...'
%
command
)
subprocess
.
check_call
(
command
,
shell
=
True
)
_print
(
"Cleaning static files ... "
)
for
static_dir
in
static_dir_list
:
static_dir
=
os
.
path
.
join
(
instance_home
,
static_dir
)
if
os
.
path
.
islink
(
static_dir
):
os
.
remove
(
static_dir
)
elif
os
.
path
.
exists
(
static_dir
):
shutil
.
rmtree
(
static_dir
)
if
load
:
if
save_mysql
:
if
os
.
path
.
exists
(
dump_sql_path
):
...
...
@@ -73,30 +58,11 @@ if load:
_print
(
"Could not find MySQL dump (%r), will recreate catalog ... "
%
dump_sql_path
)
os
.
environ
[
'erp5_tests_recreate_catalog'
]
=
'1'
_print
(
"Restoring static files ... "
)
live_instance_path
=
os
.
environ
.
get
(
'live_instance_path'
)
for
dir
in
static_dir_list
:
full_path
=
os
.
path
.
join
(
instance_home
,
dir
)
if
live_instance_path
:
backup_path
=
os
.
path
.
join
(
live_instance_path
,
dir
)
else
:
backup_path
=
full_path
+
'.bak'
if
os
.
path
.
exists
(
backup_path
):
if
not
save
or
WIN
:
shutil
.
copytree
(
backup_path
,
full_path
,
symlinks
=
True
)
else
:
if
not
live_instance_path
:
backup_path
=
os
.
path
.
basename
(
backup_path
)
os
.
symlink
(
backup_path
,
full_path
)
elif
save
and
not
(
neo_storage
or
zeo_client
)
and
os
.
path
.
exists
(
data_fs_path
):
_print
(
"About to remove existing Data.fs %s (press Ctrl+C to abort)"
%
data_fs_path
)
time
.
sleep
(
5
)
os
.
remove
(
data_fs_path
)
for
static_dir
in
static_dir_list
:
static_dir
=
os
.
path
.
join
(
instance_home
,
static_dir
)
if
not
os
.
path
.
exists
(
static_dir
):
os
.
mkdir
(
static_dir
)
zeo_server_pid
=
None
node_pid_list
=
[]
...
...
product/ERP5Type/tests/runUnitTest.py
View file @
7691ed2b
...
...
@@ -156,8 +156,6 @@ When no unit test is specified, only activities are processed.
sys
.
modules
[
'Products.ERP5Type.tests.runUnitTest'
]
=
sys
.
modules
[
__name__
]
static_dir_list
=
'Constraint'
,
'Document'
,
'Extensions'
,
'PropertySheet'
def
getUnitTestFile
():
"""returns the absolute path of this script.
This is used by template tool to run unit tests."""
...
...
@@ -701,33 +699,8 @@ def runUnitTestList(test_list, verbosity=1, debug=0, run_only=None):
coverage_process.save()
coverage_process.html_report()
if save:
os.chdir(instance_home)
if save_mysql:
save_mysql(verbosity)
if suite.__class__ not in (ProcessingNodeTestCase, ZEOServerTestCase):
# Static files are modified by the node installing business templates,
# i.e. by the node running the unit test. There is no point saving them
# on a ZEO server, or on nodes that only process activities: this has to
# be done manually.
if verbosity:
_print('Dumping static files...\n')
live_instance_path = os.environ.get('live_instance_path')
for static_dir in static_dir_list:
if os.path.islink(static_dir):
continue
if live_instance_path:
backup_path = os.path.join(live_instance_path, static_dir)
else:
backup_path = static_dir + '.bak'
try:
shutil.rmtree(backup_path)
except OSError, e:
if e.errno != errno.ENOENT:
raise
os.rename(static_dir, backup_path)
elif node_pid_list is not None:
_print('WARNING: No static files saved. You will have to do it manually.')
if save and save_mysql:
save_mysql(verbosity)
return result
...
...
@@ -873,14 +846,11 @@ def main(argument_list=None):
elif opt == "
--
persistent_memcached_server_port
":
os.environ["
persistent_memcached_server_port
"] = arg
elif opt == "
--
live_instance
":
live_instance_path = arg or real_instance_home
# following line is only for static files
os.environ["
live_instance_path
"] = live_instance_path
os.environ["
erp5_load_data_fs
"] = "
1
"
os.environ["
erp5_save_data_fs
"] = "
1
"
os.environ["
erp5_dump_sql
"] = "
0
"
os.environ["
erp5_tests_data_fs_path
"] = os.path.join(
live_instance_path
, 'var', 'Data.fs')
arg or real_instance_home
, 'var', 'Data.fs')
elif opt == "
--
random_activity_priority
":
os.environ["
random_activity_priority
"] = arg or
\
str(random.randrange(0, 1<<16))
...
...
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