Skip to content

Commit 41f0032

Browse files
nisimondjuledwar
authored andcommitted
Fix a double-delimiter bug in the CentOS finder
Noticed when running the functional tests. Also clean up a bunch of unit tests that were enforcing bad behavior.
1 parent 71b3265 commit 41f0032

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

soufi/finders/centos.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ def get_source_repos(self):
9494
"""
9595
for dir in self._get_dirs():
9696
for subdir in self.repos:
97-
url = f"{VAULT}/{dir}/{subdir}/Source/"
97+
url = f"{VAULT.rstrip('/')}/{dir}/{subdir}/Source/"
9898
if self.test_url(url + "repodata/"):
9999
yield url
100100
if self.optimal_repos:
101101
for subdir in OPTIMAL_SEARCH:
102-
url = f"{VAULT}/{dir}/{subdir}/Source/"
102+
url = f"{VAULT.rstrip('/')}/{dir}/{subdir}/Source/"
103103
if self.test_url(url + "repodata/"):
104104
yield url
105105

@@ -112,8 +112,8 @@ def get_binary_repos(self):
112112
"""
113113

114114
def _find_valid_repo_url(dir, subdir):
115-
vault_url = f"{VAULT}/{dir}/{subdir}/x86_64/"
116-
mirror_url = f"{MIRROR}/{dir}/{subdir}/x86_64/"
115+
vault_url = f"{VAULT.rstrip('/')}/{dir}/{subdir}/x86_64/"
116+
mirror_url = f"{MIRROR.rstrip('/')}/{dir}/{subdir}/x86_64/"
117117
for url in vault_url, mirror_url:
118118
if self.test_url(url + "os/repodata/"):
119119
yield url + "os/"

soufi/tests/finders/test_centos_finder.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def test__get_source_repos(self):
7070
test_url.return_value = True
7171
result = list(finder.get_source_repos())
7272
expected = [
73-
f"{centos.VAULT}/{dir}/{subdir}/Source/"
73+
f"{centos.VAULT}{dir}/{subdir}/Source/"
7474
for dir in dirs
7575
for subdir in subdirs
7676
]
@@ -86,7 +86,7 @@ def test__get_source_repos_optimal(self):
8686
test_url.return_value = True
8787
result = list(finder.get_source_repos())
8888
expected = [
89-
f"{centos.VAULT}/{dir}/{subdir}/Source/"
89+
f"{centos.VAULT}{dir}/{subdir}/Source/"
9090
for dir in dirs
9191
for subdir in (centos.DEFAULT_SEARCH + centos.OPTIMAL_SEARCH)
9292
]
@@ -102,7 +102,7 @@ def test__get_binary_repos(self):
102102
test_url.return_value = True
103103
result = list(finder.get_binary_repos())
104104
expected = [
105-
f"{centos.VAULT}/{dir}/{subdir}/x86_64/os/"
105+
f"{centos.VAULT}{dir}/{subdir}/x86_64/os/"
106106
for dir in dirs
107107
for subdir in subdirs
108108
]
@@ -118,7 +118,7 @@ def test__get_binary_repos_old_style(self):
118118
test_url.side_effect = itertools.cycle((False, True))
119119
result = list(finder.get_binary_repos())
120120
expected = [
121-
f"{centos.VAULT}/{dir}/{subdir}/x86_64/"
121+
f"{centos.VAULT}{dir}/{subdir}/x86_64/"
122122
for dir in dirs
123123
for subdir in subdirs
124124
]
@@ -134,7 +134,7 @@ def test__get_binary_repos_using_mirror(self):
134134
test_url.side_effect = itertools.cycle((False, False, True))
135135
result = list(finder.get_binary_repos())
136136
expected = [
137-
f"{centos.MIRROR}/{dir}/{subdir}/x86_64/os/"
137+
f"{centos.MIRROR}{dir}/{subdir}/x86_64/os/"
138138
for dir in dirs
139139
for subdir in subdirs
140140
]
@@ -150,7 +150,7 @@ def test__get_binary_repos_old_style_using_mirror(self):
150150
test_url.side_effect = itertools.cycle((False, False, False, True))
151151
result = list(finder.get_binary_repos())
152152
expected = [
153-
f"{centos.MIRROR}/{dir}/{subdir}/x86_64/"
153+
f"{centos.MIRROR}{dir}/{subdir}/x86_64/"
154154
for dir in dirs
155155
for subdir in subdirs
156156
]
@@ -166,7 +166,7 @@ def test__get_binary_repos_optimal(self):
166166
test_url.return_value = True
167167
result = list(finder.get_binary_repos())
168168
expected = [
169-
f"{centos.VAULT}/{dir}/{subdir}/x86_64/os/"
169+
f"{centos.VAULT}{dir}/{subdir}/x86_64/os/"
170170
for dir in dirs
171171
for subdir in (centos.DEFAULT_SEARCH + centos.OPTIMAL_SEARCH)
172172
]
@@ -182,7 +182,7 @@ def test__get_binary_repos_optimal_old_style(self):
182182
test_url.side_effect = itertools.cycle((False, True))
183183
result = list(finder.get_binary_repos())
184184
expected = [
185-
f"{centos.VAULT}/{dir}/{subdir}/x86_64/"
185+
f"{centos.VAULT}{dir}/{subdir}/x86_64/"
186186
for dir in dirs
187187
for subdir in (centos.DEFAULT_SEARCH + centos.OPTIMAL_SEARCH)
188188
]
@@ -198,7 +198,7 @@ def test__get_binary_repos_optimal_using_mirror(self):
198198
test_url.side_effect = itertools.cycle((False, False, True))
199199
result = list(finder.get_binary_repos())
200200
expected = [
201-
f"{centos.MIRROR}/{dir}/{subdir}/x86_64/os/"
201+
f"{centos.MIRROR}{dir}/{subdir}/x86_64/os/"
202202
for dir in dirs
203203
for subdir in (centos.DEFAULT_SEARCH + centos.OPTIMAL_SEARCH)
204204
]
@@ -214,7 +214,7 @@ def test__get_binary_repos_optimal_old_style_using_mirror(self):
214214
test_url.side_effect = itertools.cycle((False, False, False, True))
215215
result = list(finder.get_binary_repos())
216216
expected = [
217-
f"{centos.MIRROR}/{dir}/{subdir}/x86_64/"
217+
f"{centos.MIRROR}{dir}/{subdir}/x86_64/"
218218
for dir in dirs
219219
for subdir in (centos.DEFAULT_SEARCH + centos.OPTIMAL_SEARCH)
220220
]

0 commit comments

Comments
 (0)