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
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
Tatuya Kamada
erp5
Commits
f8842f50
Commit
f8842f50
authored
Mar 13, 2013
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do not fail when a different test suite repository branch is specified
parent
07356c25
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
8 deletions
+48
-8
erp5/tests/testERP5TestNode.py
erp5/tests/testERP5TestNode.py
+37
-3
erp5/util/testnode/Updater.py
erp5/util/testnode/Updater.py
+7
-2
erp5/util/testnode/testnode.py
erp5/util/testnode/testnode.py
+4
-3
No files found.
erp5/tests/testERP5TestNode.py
View file @
f8842f50
...
@@ -126,10 +126,9 @@ class ERP5TestNode(TestCase):
...
@@ -126,10 +126,9 @@ class ERP5TestNode(TestCase):
my_file
.
close
()
my_file
.
close
()
call
(
"git commit -av -m next_commit"
.
split
())
call
(
"git commit -av -m next_commit"
.
split
())
output
=
call
([
'git'
,
'log'
,
'--format=%H %s'
])
output
=
call
([
'git'
,
'log'
,
'--format=%H %s'
])
output
=
output
.
strip
()
output_line_list
=
output
.
split
(
"
\
n
"
)
output_line_list
=
output
.
split
(
"
\
n
"
)
self
.
assertEquals
(
3
,
len
(
output_line_list
))
self
.
assertEquals
(
2
,
len
(
output_line_list
))
# remove additional return line
output_line_list
=
output_line_list
[
0
:
2
]
expected_commit_subject_list
=
[
"next_commit"
,
"first_commit"
]
expected_commit_subject_list
=
[
"next_commit"
,
"first_commit"
]
commit_subject_list
=
[
x
.
split
()[
1
]
for
x
in
output_line_list
]
commit_subject_list
=
[
x
.
split
()[
1
]
for
x
in
output_line_list
]
self
.
assertEquals
(
expected_commit_subject_list
,
commit_subject_list
)
self
.
assertEquals
(
expected_commit_subject_list
,
commit_subject_list
)
...
@@ -234,6 +233,41 @@ branch = foo
...
@@ -234,6 +233,41 @@ branch = foo
for
vcs_repository
in
node_test_suite
.
vcs_repository_list
:
for
vcs_repository
in
node_test_suite
.
vcs_repository_list
:
self
.
assertTrue
(
os
.
path
.
exists
(
vcs_repository
[
'repository_path'
]))
self
.
assertTrue
(
os
.
path
.
exists
(
vcs_repository
[
'repository_path'
]))
def
test_05b_changeRepositoryBranch
(
self
):
"""
It could happen that the branch is changed for a repository. Testnode must
be able to reset correctly the branch
"""
commit_dict
=
self
.
generateTestRepositoryList
(
add_third_repository
=
True
)
test_node
=
self
.
getTestNode
()
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
self
.
updateNodeTestSuiteData
(
node_test_suite
,
add_third_repository
=
True
)
rev_list
=
test_node
.
getAndUpdateFullRevisionList
(
node_test_suite
)
self
.
assertEquals
(
3
,
len
(
rev_list
))
self
.
assertEquals
(
3
,
len
(
node_test_suite
.
vcs_repository_list
))
rep2_clone_path
=
[
x
[
'repository_path'
]
for
x
in
\
node_test_suite
.
vcs_repository_list
\
if
x
[
'repository_path'
].
endswith
(
"rep2"
)][
0
]
call
=
self
.
getCaller
(
cwd
=
rep2_clone_path
)
output
=
call
(
"git branch"
.
split
()).
strip
()
self
.
assertTrue
(
"* foo"
in
output
.
split
(
'
\
n
'
))
vcs_repository_info
=
node_test_suite
.
vcs_repository_list
[
0
]
self
.
assertEquals
(
vcs_repository_info
[
'repository_id'
],
'rep2'
)
self
.
assertEquals
(
vcs_repository_info
[
'branch'
],
'foo'
)
# change it to master
vcs_repository_info
[
'branch'
]
=
'master'
rev_list
=
test_node
.
getAndUpdateFullRevisionList
(
node_test_suite
)
output
=
call
(
"git branch"
.
split
()).
strip
()
print
output
self
.
assertTrue
(
"* master"
in
output
.
split
(
'
\
n
'
))
# Add a third branch on remote, make sure we could switch to it
remote_call
=
self
.
getCaller
(
cwd
=
self
.
remote_repository2
)
output
=
remote_call
(
'git checkout master -b bar'
.
split
())
vcs_repository_info
[
'branch'
]
=
'bar'
rev_list
=
test_node
.
getAndUpdateFullRevisionList
(
node_test_suite
)
output
=
call
(
"git branch"
.
split
()).
strip
()
self
.
assertTrue
(
"* bar"
in
output
.
split
(
'
\
n
'
))
def
test_06_checkRevision
(
self
):
def
test_06_checkRevision
(
self
):
"""
"""
Check if we are able to restore older commit hash if master decide so
Check if we are able to restore older commit hash if master decide so
...
...
erp5/util/testnode/Updater.py
View file @
f8842f50
...
@@ -46,10 +46,11 @@ class Updater(object):
...
@@ -46,10 +46,11 @@ class Updater(object):
stdin = file(os.devnull)
stdin = file(os.devnull)
def __init__(self, repository_path, log, revision=None, git_binary=None,
def __init__(self, repository_path, log, revision=None, git_binary=None,
realtime_output=True, process_manager=None):
branch=None,
realtime_output=True, process_manager=None):
self.log = log
self.log = log
self.revision = revision
self.revision = revision
self._path_list = []
self._path_list = []
self.branch = branch
self.repository_path = repository_path
self.repository_path = repository_path
self.git_binary = git_binary
self.git_binary = git_binary
self.realtime_output = realtime_output
self.realtime_output = realtime_output
...
@@ -144,7 +145,11 @@ class Updater(object):
...
@@ -144,7 +145,11 @@ class Updater(object):
if os.path.exists('
.
git
/
svn
'):
if os.path.exists('
.
git
/
svn
'):
self._git('
svn
', '
rebase
')
self._git('
svn
', '
rebase
')
else:
else:
self._git('
fetch
', '
--
prune
')
self._git('
fetch
', '
--
all
', '
--
prune
')
if self.branch and
\
not ("* %s" % self.branch in self._git('
branch
').split("
\
n
")):
self._git('
checkout
', '
origin
/%
s
' % self.branch, '
-
b',
self.branch)
self._git('
update
-
index
', '
--
refresh
') # see note above
self._git('
update
-
index
', '
--
refresh
') # see note above
self._git('
reset
', '
--
merge
', '
@
{
u
}
')
self._git('
reset
', '
--
merge
', '
@
{
u
}
')
self.revision = self._git_find_rev(self._git('
rev
-
parse
', '
HEAD
'))
self.revision = self._git_find_rev(self._git('
rev
-
parse
', '
HEAD
'))
...
...
erp5/util/testnode/testnode.py
View file @
f8842f50
...
@@ -213,16 +213,17 @@ branch = %(branch)s
...
@@ -213,16 +213,17 @@ branch = %(branch)s
for
vcs_repository
in
node_test_suite
.
vcs_repository_list
:
for
vcs_repository
in
node_test_suite
.
vcs_repository_list
:
repository_path
=
vcs_repository
[
'repository_path'
]
repository_path
=
vcs_repository
[
'repository_path'
]
repository_id
=
vcs_repository
[
'repository_id'
]
repository_id
=
vcs_repository
[
'repository_id'
]
branch
=
vcs_repository
.
get
(
'branch'
)
if
not
os
.
path
.
exists
(
repository_path
):
if
not
os
.
path
.
exists
(
repository_path
):
parameter_list
=
[
config
[
'git_binary'
],
'clone'
,
parameter_list
=
[
config
[
'git_binary'
],
'clone'
,
vcs_repository
[
'url'
]]
vcs_repository
[
'url'
]]
if
vcs_repository
.
get
(
'branch'
)
is
not
None
:
if
branch
is
not
None
:
parameter_list
.
extend
([
'-b'
,
vcs_repository
.
get
(
'branch'
)
])
parameter_list
.
extend
([
'-b'
,
branch
])
parameter_list
.
append
(
repository_path
)
parameter_list
.
append
(
repository_path
)
log
(
subprocess
.
check_output
(
parameter_list
,
stderr
=
subprocess
.
STDOUT
))
log
(
subprocess
.
check_output
(
parameter_list
,
stderr
=
subprocess
.
STDOUT
))
# Make sure we have local repository
# Make sure we have local repository
updater
=
Updater
(
repository_path
,
git_binary
=
config
[
'git_binary'
],
updater
=
Updater
(
repository_path
,
git_binary
=
config
[
'git_binary'
],
log
=
log
,
process_manager
=
self
.
process_manager
)
branch
=
branch
,
log
=
log
,
process_manager
=
self
.
process_manager
)
updater
.
checkout
()
updater
.
checkout
()
revision
=
"-"
.
join
(
updater
.
getRevision
())
revision
=
"-"
.
join
(
updater
.
getRevision
())
full_revision_list
.
append
(
'%s=%s'
%
(
repository_id
,
revision
))
full_revision_list
.
append
(
'%s=%s'
%
(
repository_id
,
revision
))
...
...
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