Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Debian New Member Process
nm.debian.org
Commits
3fb74cf7
Commit
3fb74cf7
authored
Apr 21, 2022
by
Enrico Zini
Browse files
Fixed deploy tests after the rename from master to main
parent
710d823c
Changes
1
Show whitespace changes
Inline
Side-by-side
deploy/tests.py
View file @
3fb74cf7
...
...
@@ -13,12 +13,12 @@ class Env:
self
.
queuedir
=
os
.
path
.
join
(
self
.
workdir
,
"queue"
)
os
.
mkdir
(
self
.
queuedir
)
self
.
repodir
=
os
.
path
.
join
(
self
.
workdir
,
"repo"
)
self
.
ma
ster
_hexsha
=
None
self
.
ma
in
_hexsha
=
None
def
create_repo
(
self
):
repo
=
git
.
Repo
.
init
(
self
.
repodir
,
bare
=
False
)
repo
=
git
.
Repo
.
init
(
self
.
repodir
,
bare
=
False
,
initial_branch
=
'main'
)
commit
=
repo
.
index
.
commit
(
"Creating a branch"
)
self
.
ma
ster
_hexsha
=
commit
.
hexsha
self
.
ma
in
_hexsha
=
commit
.
hexsha
# Not available on current debian stable
# repo.close()
...
...
@@ -34,21 +34,21 @@ class TestDeploy(TestCase):
def
test_select_branch
(
self
):
with
self
.
env
()
as
env
:
with
open
(
os
.
path
.
join
(
env
.
queuedir
,
env
.
ma
ster
_hexsha
+
".deploy"
),
"w"
):
with
open
(
os
.
path
.
join
(
env
.
queuedir
,
env
.
ma
in
_hexsha
+
".deploy"
),
"w"
):
pass
with
open
(
os
.
path
.
join
(
env
.
queuedir
,
"1111111111111111111111111111111111111111.deploy"
),
"w"
):
pass
with
self
.
settings
(
DEPLOY_BRANCH
=
"ma
ster
"
):
with
self
.
settings
(
DEPLOY_BRANCH
=
"ma
in
"
):
deployer
=
Deployer
(
root
=
env
.
repodir
)
deployer
.
select_branch
(
fetch
=
False
)
self
.
assertEqual
(
deployer
.
branch
,
"ma
ster
"
)
self
.
assertEqual
(
deployer
.
ref
.
commit
.
hexsha
,
env
.
ma
ster
_hexsha
)
self
.
assertEqual
(
deployer
.
branch
,
"ma
in
"
)
self
.
assertEqual
(
deployer
.
ref
.
commit
.
hexsha
,
env
.
ma
in
_hexsha
)
def
test_select_branch_fail
(
self
):
with
self
.
env
()
as
env
:
with
open
(
os
.
path
.
join
(
env
.
queuedir
,
"1111111111111111111111111111111111111111.deploy"
),
"w"
):
pass
with
self
.
settings
(
DEPLOY_BRANCH
=
"ma
ster
"
):
with
self
.
settings
(
DEPLOY_BRANCH
=
"ma
in
"
):
deployer
=
Deployer
(
root
=
env
.
repodir
)
with
self
.
assertRaises
(
Fail
)
as
e
:
deployer
.
select_branch
(
fetch
=
False
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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