Merge lp:~robru/cupstream2distro/drop-safe-join into lp:cupstream2distro
- drop-safe-join
- Merge into trunk
Proposed by
Robert Bruce Park
Status: | Merged |
---|---|
Approved by: | Robert Bruce Park |
Approved revision: | 1081 |
Merged at revision: | 1081 |
Proposed branch: | lp:~robru/cupstream2distro/drop-safe-join |
Merge into: | lp:cupstream2distro |
Diff against target: |
1383 lines (+179/-233) 19 files modified
citrain/setup_citrain.py (+7/-7) cupstream2distro/archive.py (+4/-4) cupstream2distro/launchpadmanager.py (+4/-5) cupstream2distro/packagemanager.py (+9/-11) cupstream2distro/project.py (+6/-7) cupstream2distro/utils.py (+2/-8) tests/unit/__init__.py (+11/-11) tests/unit/test_archive.py (+8/-8) tests/unit/test_branchhandling.py (+13/-12) tests/unit/test_packagelist.py (+3/-3) tests/unit/test_packagemanager.py (+65/-90) tests/unit/test_project.py (+19/-18) tests/unit/test_recipe_base.py (+5/-4) tests/unit/test_recipe_secondary.py (+5/-4) tests/unit/test_revno.py (+4/-2) tests/unit/test_script_migration.py (+2/-2) tests/unit/test_script_prepare_silo.py (+4/-4) tests/unit/test_script_setup_citrain.py (+6/-5) tests/unit/test_utils.py (+2/-28) |
To merge this branch: | bzr merge lp:~robru/cupstream2distro/drop-safe-join |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
CU2D maintainers | Pending | ||
Review via email: mp+270615@code.launchpad.net |
Commit message
Drop os_path_join_safe crutch now that path chaos has settled.
Description of the change
To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) : | # |
review:
Approve
(continuous-integration)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'citrain/setup_citrain.py' |
2 | --- citrain/setup_citrain.py 2015-08-22 04:36:15 +0000 |
3 | +++ citrain/setup_citrain.py 2015-09-10 02:16:41 +0000 |
4 | @@ -32,10 +32,11 @@ |
5 | |
6 | sys.path.append(os.path.dirname(os.path.dirname(__file__))) |
7 | |
8 | +from os.path import dirname, expanduser, join |
9 | + |
10 | from cupstream2distro.launchpadmanager import lp |
11 | from cupstream2distro.utils import ( |
12 | log_value_of, |
13 | - os_path_join_safe, |
14 | run_script, |
15 | suppress, |
16 | utf8_open, |
17 | @@ -51,9 +52,8 @@ |
18 | ) |
19 | |
20 | |
21 | -JOBS_DIR = os.path.expanduser(os_path_join_safe('~', 'jobs')) |
22 | -TEMPLATE_DIR = os_path_join_safe( |
23 | - os.path.dirname(__file__), 'jenkins-templates') |
24 | +JOBS_DIR = expanduser(join('~', 'jobs')) |
25 | +TEMPLATE_DIR = join(dirname(__file__), 'jenkins-templates') |
26 | |
27 | |
28 | def discover_silos(): |
29 | @@ -78,7 +78,7 @@ |
30 | |
31 | def load_template(template_name, context): |
32 | """Load the template from disk and fill out string format variables.""" |
33 | - with utf8_open(os_path_join_safe(TEMPLATE_DIR, template_name)) as templ: |
34 | + with utf8_open(join(TEMPLATE_DIR, template_name)) as templ: |
35 | return templ.read().format(**context) |
36 | |
37 | |
38 | @@ -89,8 +89,8 @@ |
39 | log_value_of.template_name() |
40 | context['BINDIR'] = CITRAIN_BINDIR |
41 | context['RSYNC_OUTDIR'] = SILO_RSYNCDIR |
42 | - jobdir = os_path_join_safe(JOBS_DIR, jobname) |
43 | - config_file = os_path_join_safe(jobdir, 'config.xml') |
44 | + jobdir = join(JOBS_DIR, jobname) |
45 | + config_file = join(jobdir, 'config.xml') |
46 | with suppress(OSError): |
47 | os.makedirs(jobdir) |
48 | with utf8_open(config_file, 'w') as data: |
49 | |
50 | === modified file 'cupstream2distro/archive.py' |
51 | --- cupstream2distro/archive.py 2015-08-22 04:53:32 +0000 |
52 | +++ cupstream2distro/archive.py 2015-09-10 02:16:41 +0000 |
53 | @@ -20,6 +20,7 @@ |
54 | import shutil |
55 | import logging |
56 | |
57 | +from os.path import join |
58 | from operator import attrgetter |
59 | from six.moves.urllib.parse import unquote |
60 | from six.moves.urllib.request import urlretrieve |
61 | @@ -29,7 +30,6 @@ |
62 | from cupstream2distro.utils import ( |
63 | log_call, |
64 | log_value_of, |
65 | - os_path_join_safe, |
66 | suppress, |
67 | ) |
68 | |
69 | @@ -132,7 +132,7 @@ |
70 | version = source.source_package_version |
71 | logging.info('Downloading {} to {}'.format(source.display_name, path)) |
72 | for url in source.sourceFileUrls(): |
73 | - filepath = os_path_join_safe(path, unquote(url.split('/')[-1])) |
74 | + filepath = join(path, unquote(url.split('/')[-1])) |
75 | if V(version).get_upstream() in filepath: |
76 | urlretrieve(url, filepath) |
77 | return self.unpack_archive_dsc(path, version.split(':')[-1]) |
78 | @@ -144,9 +144,9 @@ |
79 | :param path: The directory containing the dsc file(s). |
80 | :returns: The name of the unpacked directory. |
81 | """ |
82 | - dsc = os_path_join_safe(path, '{}_{}.dsc'.format(self.name, version)) |
83 | + dsc = join(path, '{}_{}.dsc'.format(self.name, version)) |
84 | instance = log_call(['dpkg-source', '-x', dsc], cwd=path)[0] |
85 | - shortname = os_path_join_safe(path, self.name) |
86 | + shortname = join(path, self.name) |
87 | fullname = '{}-{}'.format(shortname, V(version).get_upstream()) |
88 | if not os.path.isdir(fullname) or instance.returncode != 0: |
89 | raise ArchiveError('Download failed: {}'.format(fullname)) |
90 | |
91 | === modified file 'cupstream2distro/launchpadmanager.py' |
92 | --- cupstream2distro/launchpadmanager.py 2015-09-05 01:35:22 +0000 |
93 | +++ cupstream2distro/launchpadmanager.py 2015-09-10 02:16:41 +0000 |
94 | @@ -18,14 +18,14 @@ |
95 | |
96 | import os |
97 | |
98 | +from os.path import expanduser, join |
99 | from launchpadlib.launchpad import Launchpad |
100 | |
101 | -from cupstream2distro.utils import env, memoize, os_path_join_safe, singleton |
102 | +from cupstream2distro.utils import env, memoize, singleton |
103 | from cupstream2distro.settings import COMMON_LAUNCHPAD_CACHE_DIR |
104 | |
105 | |
106 | -CREDS_PATH = os.path.expanduser( |
107 | - os_path_join_safe('~', '.launchpad.credentials')) |
108 | +CREDS_PATH = expanduser(join('~', '.launchpad.credentials')) |
109 | |
110 | |
111 | MP_ROOT = 'https://code.launchpad.net/' |
112 | @@ -78,8 +78,7 @@ |
113 | # as launchpadlib isn't multiproc, fiddling the cache dir if any |
114 | launchpadlib_dir = None |
115 | if env.JOB_NAME: |
116 | - launchpadlib_dir = os_path_join_safe( |
117 | - COMMON_LAUNCHPAD_CACHE_DIR, env.JOB_NAME) |
118 | + launchpadlib_dir = join(COMMON_LAUNCHPAD_CACHE_DIR, env.JOB_NAME) |
119 | login_args = dict( |
120 | application_name='cupstream2distro', |
121 | service_root='staging' if use_staging else 'production', |
122 | |
123 | === modified file 'cupstream2distro/packagemanager.py' |
124 | --- cupstream2distro/packagemanager.py 2015-09-02 23:09:21 +0000 |
125 | +++ cupstream2distro/packagemanager.py 2015-09-10 02:16:41 +0000 |
126 | @@ -20,7 +20,7 @@ |
127 | import re |
128 | import os |
129 | |
130 | -from os.path import basename, dirname |
131 | +from os.path import basename, dirname, join |
132 | from glob import glob |
133 | |
134 | from cupstream2distro.version import V |
135 | @@ -38,7 +38,6 @@ |
136 | env, |
137 | log_call, |
138 | log_value_of, |
139 | - os_path_join_safe, |
140 | utf8_inplace, |
141 | utf8_open, |
142 | ) |
143 | @@ -130,17 +129,17 @@ |
144 | @property |
145 | def debian(self): |
146 | """Locate debian/ directory.""" |
147 | - return os_path_join_safe(self.path, 'debian') |
148 | + return join(self.path, 'debian') |
149 | |
150 | @property |
151 | def debian_control(self): |
152 | """Locate debian/control.""" |
153 | - return os_path_join_safe(self.debian, 'control') |
154 | + return join(self.debian, 'control') |
155 | |
156 | @property |
157 | def debian_changelog(self): |
158 | """Locate debian/changelog.""" |
159 | - return os_path_join_safe(self.debian, 'changelog') |
160 | + return join(self.debian, 'changelog') |
161 | |
162 | def correct_package_changelog(self, version, series): |
163 | """Insert the correct series & version into the changelog. |
164 | @@ -205,7 +204,7 @@ |
165 | ] |
166 | files = [] |
167 | for entry in whitelist: |
168 | - files.extend(glob(os_path_join_safe(self.debian, entry))) |
169 | + files.extend(glob(join(self.debian, entry))) |
170 | |
171 | for path in files: |
172 | if os.path.isfile(path) and not os.path.islink(path): |
173 | @@ -224,8 +223,8 @@ |
174 | |
175 | def build_package(self, series, distro_version): |
176 | """Build the source package in a chroot.""" |
177 | - tool_dir = os_path_join_safe(ROOT_CU2D, 'chroot-tools') |
178 | - buildsource = os_path_join_safe(tool_dir, 'buildsource-chroot') |
179 | + tool_dir = join(ROOT_CU2D, 'chroot-tools') |
180 | + buildsource = join(tool_dir, 'buildsource-chroot') |
181 | environ = os.environ.copy() |
182 | environ.update(HOME=tool_dir, DIST=series) |
183 | log_call(['./create-chroot'], cwd=tool_dir, env=environ) |
184 | @@ -251,9 +250,8 @@ |
185 | def generate_package_diffs(self, old_dsc, new_dsc): |
186 | """Generate content and packaging-only diffs for this package.""" |
187 | parent = dirname(new_dsc) |
188 | - full_path = os_path_join_safe(parent, FULL_DIFF.format(self.name)) |
189 | - packaging_path = os_path_join_safe( |
190 | - parent, PACKAGING_DIFF.format(self.name)) |
191 | + full_path = join(parent, FULL_DIFF.format(self.name)) |
192 | + packaging_path = join(parent, PACKAGING_DIFF.format(self.name)) |
193 | full_diff = call(['debdiff', old_dsc or '', new_dsc], cwd=parent)[1] |
194 | with utf8_open(full_path, 'w') as full: |
195 | full.write(full_diff) |
196 | |
197 | === modified file 'cupstream2distro/project.py' |
198 | --- cupstream2distro/project.py 2015-08-22 05:04:58 +0000 |
199 | +++ cupstream2distro/project.py 2015-09-10 02:16:41 +0000 |
200 | @@ -16,15 +16,15 @@ |
201 | |
202 | """Class for .project files, which store per-package version numbers.""" |
203 | |
204 | -import glob |
205 | import os |
206 | |
207 | +from glob import glob |
208 | +from os.path import join |
209 | from six.moves import configparser |
210 | |
211 | from cupstream2distro.utils import ( |
212 | SILO_DIR, |
213 | log_value_of, |
214 | - os_path_join_safe, |
215 | suppress, |
216 | utf8_open, |
217 | ) |
218 | @@ -34,7 +34,7 @@ |
219 | |
220 | def _get_project_files(infix): |
221 | """Glob for the project files.""" |
222 | - return glob.glob(os_path_join_safe(SILO_DIR(), '*{}'.format(infix))) |
223 | + return glob(join(SILO_DIR(), '*{}'.format(infix))) |
224 | |
225 | |
226 | def _get_state(filename): |
227 | @@ -80,15 +80,14 @@ |
228 | |
229 | def __init__(self, source_package_name): |
230 | """Identify the location of the .project file.""" |
231 | - object.__setattr__(self, 'name', source_package_name) |
232 | - object.__setattr__(self, 'filename', os_path_join_safe( |
233 | - SILO_DIR(), self.name + self.SUFFIX)) |
234 | + super().__setattr__('name', source_package_name) |
235 | + super().__setattr__('filename', SILO_DIR(self.name + self.SUFFIX)) |
236 | |
237 | @property |
238 | def state(self): |
239 | """Load the .project file from disk if necessary.""" |
240 | if not self._state: |
241 | - object.__setattr__(self, '_state', _get_state(self.filename)) |
242 | + super().__setattr__('_state', _get_state(self.filename)) |
243 | return self._state |
244 | |
245 | def __getattr__(self, key): |
246 | |
247 | === modified file 'cupstream2distro/utils.py' |
248 | --- cupstream2distro/utils.py 2015-09-08 21:24:58 +0000 |
249 | +++ cupstream2distro/utils.py 2015-09-10 02:16:41 +0000 |
250 | @@ -28,7 +28,7 @@ |
251 | from inspect import currentframe |
252 | from contextlib import contextmanager |
253 | from six.moves.urllib.parse import unquote |
254 | -from os.path import basename, isabs, exists, join |
255 | +from os.path import basename, exists, join |
256 | |
257 | from cupstream2distro.settings import SILOS_DIR |
258 | |
259 | @@ -84,12 +84,6 @@ |
260 | return single() |
261 | |
262 | |
263 | -def os_path_join_safe(first, *rest): |
264 | - """Raise an exception if you try to join absolute paths together.""" |
265 | - assert True not in [isabs(part) for part in rest] |
266 | - return join(first, *rest) |
267 | - |
268 | - |
269 | @singleton |
270 | class env(object): |
271 | """Handle some common environment variable manipulations.""" |
272 | @@ -120,7 +114,7 @@ |
273 | |
274 | def SILO_DIR(*parts): |
275 | """Return the directory of the currently active silo.""" |
276 | - return os_path_join_safe(SILOS_DIR, env.SILONAME, *parts) |
277 | + return join(SILOS_DIR, env.SILONAME, *parts) |
278 | |
279 | |
280 | @singleton |
281 | |
282 | === modified file 'tests/unit/__init__.py' |
283 | --- tests/unit/__init__.py 2015-09-05 03:54:05 +0000 |
284 | +++ tests/unit/__init__.py 2015-09-10 02:16:41 +0000 |
285 | @@ -23,9 +23,10 @@ |
286 | import tempfile |
287 | import unittest |
288 | |
289 | +from os.path import join |
290 | from mock import Mock |
291 | |
292 | -from cupstream2distro.utils import env, os_path_join_safe, suppress, utf8_open |
293 | +from cupstream2distro.utils import env, suppress, utf8_open |
294 | |
295 | |
296 | def clean(line): |
297 | @@ -38,13 +39,13 @@ |
298 | maxDiff = None |
299 | _tempdir = None |
300 | test_dir = os.path.dirname(os.path.dirname(__file__)) |
301 | - data_dir = os_path_join_safe(test_dir, 'data') |
302 | - changelogs_file_dir = os_path_join_safe(data_dir, 'changelogs') |
303 | - result_dir = os_path_join_safe(data_dir, 'results') |
304 | - project_file_dir = os_path_join_safe(data_dir, 'project_files') |
305 | + data_dir = join(test_dir, 'data') |
306 | + changelogs_dir = join(data_dir, 'changelogs') |
307 | + result_dir = join(data_dir, 'results') |
308 | + project_file_dir = join(data_dir, 'project_files') |
309 | root_dir = os.path.dirname(test_dir) |
310 | - train_dir = os_path_join_safe(root_dir, 'citrain') |
311 | - cup_dir = os_path_join_safe(root_dir, 'cupstream2distro') |
312 | + train_dir = join(root_dir, 'citrain') |
313 | + cup_dir = join(root_dir, 'cupstream2distro') |
314 | |
315 | def setUp(self): |
316 | """Time how long each test runs.""" |
317 | @@ -96,7 +97,7 @@ |
318 | |
319 | def prep_debian_file(self, filename, content): |
320 | """Prepare a file for modification.""" |
321 | - path = os_path_join_safe(self.tempdir, 'debian', filename) |
322 | + path = join(self.tempdir, 'debian', filename) |
323 | with suppress(OSError): |
324 | os.mkdir(os.path.dirname(path)) |
325 | with utf8_open(path, 'w') as f: |
326 | @@ -133,7 +134,7 @@ |
327 | if self.scriptname: |
328 | self.script = imp.load_source( |
329 | os.path.basename(self.scriptname).split('.')[0], |
330 | - os_path_join_safe(self.train_dir, self.scriptname)) |
331 | + join(self.train_dir, self.scriptname)) |
332 | self.script.Archive = Mock() |
333 | self.script.Branch = Mock() |
334 | self.script.DotProject = Mock() |
335 | @@ -157,8 +158,7 @@ |
336 | self.script.shutil = Mock() |
337 | self.script.silo_state = Mock() |
338 | self.script.time = Mock() |
339 | - self.script.SILO_DIR = lambda *parts: os_path_join_safe( |
340 | - self.tempdir, *parts) |
341 | + self.script.SILO_DIR = lambda *parts: join(self.tempdir, *parts) |
342 | self.script.ALL_SILO_NAMES = [ |
343 | 'ubuntu/landing-{:03d}'.format(x) for x in range(0, 10)] |
344 | self.script.SILO_NAME_LIST = dict( |
345 | |
346 | === modified file 'tests/unit/test_archive.py' |
347 | --- tests/unit/test_archive.py 2015-08-30 08:24:36 +0000 |
348 | +++ tests/unit/test_archive.py 2015-09-10 02:16:41 +0000 |
349 | @@ -16,6 +16,7 @@ |
350 | |
351 | """Tests for launchpadlib archive-related functions.""" |
352 | |
353 | +from os.path import join |
354 | from datetime import datetime |
355 | from mock import Mock, patch, call |
356 | |
357 | @@ -25,7 +26,6 @@ |
358 | from cupstream2distro import archive |
359 | from cupstream2distro.archive import Archive, ArchWatcher |
360 | from cupstream2distro.errors import ArchiveError |
361 | -from cupstream2distro.utils import os_path_join_safe |
362 | |
363 | |
364 | class DistroArchSeries(object): |
365 | @@ -260,8 +260,8 @@ |
366 | log_call.return_value = Mock(returncode=0), '', '' |
367 | self.assertEqual( |
368 | self.archive.unpack_archive_dsc(self.tempdir, '1.0-0ubuntu1'), |
369 | - os_path_join_safe(self.tempdir, 'dl')) |
370 | - shortname = os_path_join_safe(self.tempdir, 'dl') |
371 | + join(self.tempdir, 'dl')) |
372 | + shortname = join(self.tempdir, 'dl') |
373 | fullname = shortname + '-1.0' |
374 | log_call.assert_called_once_with( |
375 | ['dpkg-source', '-x', shortname + '_1.0-0ubuntu1.dsc'], |
376 | @@ -276,11 +276,11 @@ |
377 | self.archive.name = 'dl' |
378 | os_mock.path.isdir.return_value = True |
379 | log_call.return_value = Mock(returncode=0), '', '' |
380 | - path = os_path_join_safe(self.tempdir, 'ubuntu', 'dl') |
381 | + path = join(self.tempdir, 'ubuntu', 'dl') |
382 | self.assertEqual( |
383 | self.archive.unpack_archive_dsc(path, '1.0-0ubuntu1'), |
384 | - os_path_join_safe(path, 'dl-1.0')) |
385 | - shortname = os_path_join_safe(path, 'dl') |
386 | + join(path, 'dl-1.0')) |
387 | + shortname = join(path, 'dl') |
388 | log_call.assert_called_once_with( |
389 | ['dpkg-source', '-x', shortname + '_1.0-0ubuntu1.dsc'], |
390 | cwd=path) |
391 | @@ -293,7 +293,7 @@ |
392 | self.archive.name = 'dl' |
393 | os_mock.path.isdir.return_value = False |
394 | log_call.return_value = Mock(returncode=0), '', '' |
395 | - path = os_path_join_safe(self.tempdir, 'ubuntu', 'dl') |
396 | + path = join(self.tempdir, 'ubuntu', 'dl') |
397 | with self.assertRaisesRegexp(ArchiveError, 'Download failed'): |
398 | self.archive.unpack_archive_dsc(path, '1.0-0ubuntu1') |
399 | |
400 | @@ -304,7 +304,7 @@ |
401 | self.archive.name = 'dl' |
402 | os_mock.path.isdir.return_value = True |
403 | log_call.return_value = Mock(returncode=1), '', '' |
404 | - path = os_path_join_safe(self.tempdir, 'ubuntu', 'dl') |
405 | + path = join(self.tempdir, 'ubuntu', 'dl') |
406 | with self.assertRaisesRegexp(ArchiveError, 'Download failed'): |
407 | self.archive.unpack_archive_dsc(path, '1.0-0ubuntu1') |
408 | |
409 | |
410 | === modified file 'tests/unit/test_branchhandling.py' |
411 | --- tests/unit/test_branchhandling.py 2015-09-09 00:14:07 +0000 |
412 | +++ tests/unit/test_branchhandling.py 2015-09-10 02:16:41 +0000 |
413 | @@ -16,15 +16,16 @@ |
414 | |
415 | """Tests for bzr branch related functions.""" |
416 | |
417 | +from os.path import join |
418 | +from mock import Mock, patch, call |
419 | from six.moves import range as gen_range |
420 | -from mock import Mock, patch, call |
421 | |
422 | from tests import strings as s |
423 | from tests.unit import BaseTestCase |
424 | |
425 | from cupstream2distro import branchhandling |
426 | +from cupstream2distro.utils import utf8_open |
427 | from cupstream2distro.branchhandling import Branch |
428 | -from cupstream2distro.utils import os_path_join_safe, utf8_open |
429 | from cupstream2distro.errors import BranchError, MergeError |
430 | |
431 | |
432 | @@ -68,7 +69,7 @@ |
433 | @patch('cupstream2distro.branchhandling.log_call') |
434 | def test_branching(self, call_mock): |
435 | """We correcly branch a branch.""" |
436 | - path = self.branch.path = os_path_join_safe(self.tempdir, 'foo') |
437 | + path = self.branch.path = join(self.tempdir, 'foo') |
438 | call_mock.return_value = (Mock(returncode=0), '', '') |
439 | self.branch.get_branch('lp:foo') |
440 | call_mock.assert_called_once_with( |
441 | @@ -77,7 +78,7 @@ |
442 | @patch('cupstream2distro.branchhandling.log_call') |
443 | def test_branching_failed(self, call_mock): |
444 | """Raise an exception when branching fails.""" |
445 | - path = self.branch.path = os_path_join_safe(self.tempdir, 'foo') |
446 | + path = self.branch.path = join(self.tempdir, 'foo') |
447 | call_mock.return_value = (Mock(returncode=42), '', 'intarwebz broked.') |
448 | with self.assertRaisesRegexp(BranchError, 'Branching lp:foo failed.'): |
449 | self.branch.get_branch('lp:foo') |
450 | @@ -132,7 +133,7 @@ |
451 | @patch('cupstream2distro.branchhandling.log_call') |
452 | def test_merge_branch_unicode(self, call_mock, tmp_mock): |
453 | """Merging branch accepts unicode.""" |
454 | - tmpfile = os_path_join_safe(self.tempdir, 'tempfile') |
455 | + tmpfile = join(self.tempdir, 'tempfile') |
456 | tmp_mock.return_value = (0, tmpfile) |
457 | call_mock.return_value = (Mock(returncode=0), '', '') |
458 | self.branch.merge_branch('lp:example', '.ʇɹoddns ǝpoɔıun pǝppɐ') |
459 | @@ -146,7 +147,7 @@ |
460 | @patch('cupstream2distro.branchhandling.log_call') |
461 | def test_merge_branch_debcommit(self, call_mock, tmp_mock): |
462 | """Merging branch accepts unicode.""" |
463 | - tmpfile = os_path_join_safe(self.tempdir, 'tempfile') |
464 | + tmpfile = join(self.tempdir, 'tempfile') |
465 | tmp_mock.return_value = (0, tmpfile) |
466 | call_mock.return_value = (Mock(returncode=0), '', '') |
467 | self.branch.merge_branch('lp:example') |
468 | @@ -163,7 +164,7 @@ |
469 | (Mock(returncode=1), '', ''), |
470 | (Mock(returncode=0), '', ''), |
471 | ] |
472 | - tmpfile = os_path_join_safe(self.tempdir, 'tempfile') |
473 | + tmpfile = join(self.tempdir, 'tempfile') |
474 | tmp_mock.return_value = (0, tmpfile) |
475 | call_mock.side_effect = lambda *ig, **nore: calls.pop() |
476 | with self.assertRaisesRegexp(MergeError, 'No commit message found'): |
477 | @@ -177,7 +178,7 @@ |
478 | @patch('cupstream2distro.branchhandling.log_call') |
479 | def test_merge_branch_failed(self, call_mock, tmp_mock): |
480 | """Merging raises the appropriate exception when it fails.""" |
481 | - tmpfile = os_path_join_safe(self.tempdir, 'tempfile') |
482 | + tmpfile = join(self.tempdir, 'tempfile') |
483 | tmp_mock.return_value = (0, tmpfile) |
484 | call_mock.return_value = (Mock(returncode=1), '', '') |
485 | with self.assertRaisesRegexp(MergeError, 'Merge conflict'): |
486 | @@ -232,7 +233,7 @@ |
487 | |
488 | def mock_diff_since_newest_tag(self, filename): |
489 | """Configure mock for use by Branch.get_branch_commits().""" |
490 | - path = os_path_join_safe(self.data_dir, 'bzrlogs', filename) |
491 | + path = join(self.data_dir, 'bzrlogs', filename) |
492 | with utf8_open(path) as branch_log: |
493 | self.branch.diff_since_newest_branch_tag = Mock( |
494 | return_value=branch_log.read()) |
495 | @@ -392,7 +393,7 @@ |
496 | @patch('cupstream2distro.branchhandling.log_call') |
497 | def test_commit_branch(self, call_mock, tmp_mock): |
498 | """Ensure we invoke bzr correctly while committing.""" |
499 | - tmpfile = os_path_join_safe(self.tempdir, 'tempfile') |
500 | + tmpfile = join(self.tempdir, 'tempfile') |
501 | tmp_mock.return_value = (0, tmpfile) |
502 | call_mock.return_value = (Mock(returncode=0), 'Committed to...', '') |
503 | self.branch.commit_branch( |
504 | @@ -406,7 +407,7 @@ |
505 | @patch('cupstream2distro.branchhandling.log_call') |
506 | def test_commit_branch_failed(self, call_mock, tmp_mock): |
507 | """Ensure we raise the appropriate error when committing fails.""" |
508 | - tmpfile = os_path_join_safe(self.tempdir, 'tempfile') |
509 | + tmpfile = join(self.tempdir, 'tempfile') |
510 | tmp_mock.return_value = (0, tmpfile) |
511 | call_mock.return_value = (Mock(returncode=1), '', 'borked') |
512 | with self.assertRaisesRegexp(BranchError, 'Failed to commit'): |
513 | @@ -420,7 +421,7 @@ |
514 | @patch('cupstream2distro.branchhandling.log_call') |
515 | def test_commit_branch_failed_unchanged_ok(self, call_mock, tmp_mock): |
516 | """Happily ignore failures to commit when not creating empty commit.""" |
517 | - tmpfile = os_path_join_safe(self.tempdir, 'tempfile') |
518 | + tmpfile = join(self.tempdir, 'tempfile') |
519 | tmp_mock.return_value = (0, tmpfile) |
520 | call_mock.return_value = (Mock(returncode=1), '', 'borked') |
521 | self.branch.commit_branch( |
522 | |
523 | === modified file 'tests/unit/test_packagelist.py' |
524 | --- tests/unit/test_packagelist.py 2015-09-04 03:44:13 +0000 |
525 | +++ tests/unit/test_packagelist.py 2015-09-10 02:16:41 +0000 |
526 | @@ -16,14 +16,14 @@ |
527 | |
528 | """Tests for CI Train PackageList class.""" |
529 | |
530 | -from os.path import dirname |
531 | +from os.path import dirname, join |
532 | from os import makedirs |
533 | from mock import Mock, patch |
534 | |
535 | from tests.unit import DirectoryAwareTestCase |
536 | |
537 | from cupstream2distro.packagelist import PackageList |
538 | -from cupstream2distro.utils import env, os_path_join_safe, utf8_open |
539 | +from cupstream2distro.utils import env, utf8_open |
540 | from cupstream2distro.errors import PublishError |
541 | |
542 | API = 'https://api.launchpad.net/devel/' |
543 | @@ -120,7 +120,7 @@ |
544 | 'ci-train-ppa-service/ubuntu/landing-789\tRelease\tvivid' |
545 | '\tProposed\tvivid\tbar\t2.0-0ubuntu1\t0.9\trobru\tubuntu\n', |
546 | ] |
547 | - result_path = os_path_join_safe( |
548 | + result_path = join( |
549 | self.tempdir, 'ubuntu', 'landing-789', |
550 | 'packagelist_rsync_ubuntu-landing-789') |
551 | makedirs(dirname(result_path), exist_ok=True) |
552 | |
553 | === modified file 'tests/unit/test_packagemanager.py' |
554 | --- tests/unit/test_packagemanager.py 2015-09-03 00:06:03 +0000 |
555 | +++ tests/unit/test_packagemanager.py 2015-09-10 02:16:41 +0000 |
556 | @@ -18,8 +18,9 @@ |
557 | |
558 | import os |
559 | |
560 | +from os.path import join |
561 | +from pprint import pprint |
562 | from mock import Mock, patch, call |
563 | -from pprint import pprint |
564 | |
565 | from tests.unit import BaseTestCase |
566 | from tests import strings as s |
567 | @@ -27,7 +28,7 @@ |
568 | from cupstream2distro import utils |
569 | from cupstream2distro import packagemanager |
570 | from cupstream2distro.packagemanager import Package |
571 | -from cupstream2distro.utils import env, os_path_join_safe, utf8_open |
572 | +from cupstream2distro.utils import env, utf8_open |
573 | from cupstream2distro.errors import PackageError |
574 | from cupstream2distro.settings import PACKAGING_DIFF, FULL_DIFF |
575 | |
576 | @@ -38,17 +39,15 @@ |
577 | def setUp(self): |
578 | """Set SILO_DIR to tempdir so we can create files safely.""" |
579 | super().setUp() |
580 | - packagemanager.SILO_DIR = lambda *p: os_path_join_safe( |
581 | - self.tempdir, *p) |
582 | + packagemanager.SILO_DIR = lambda *parts: join(self.tempdir, *parts) |
583 | self.package = Package() |
584 | self.package.path = self.tempdir |
585 | self.package.name = 'wheee-doggy' |
586 | self.package.series = Mock() |
587 | - self.bsc = os_path_join_safe( |
588 | - self.root_dir, 'chroot-tools', 'buildsource-chroot') |
589 | - self.full_diff_path = os_path_join_safe( |
590 | + self.bsc = join(self.root_dir, 'chroot-tools', 'buildsource-chroot') |
591 | + self.full_diff_path = join( |
592 | self.tempdir, FULL_DIFF.format('wheee-doggy')) |
593 | - self.pkg_diff_path = os_path_join_safe( |
594 | + self.pkg_diff_path = join( |
595 | self.tempdir, PACKAGING_DIFF.format('wheee-doggy')) |
596 | env.CREATOR_NAME = '' |
597 | env.CREATOR_EMAIL = '' |
598 | @@ -106,13 +105,13 @@ |
599 | """Ensure properties return correct values.""" |
600 | self.assertEqual( |
601 | self.package.debian, |
602 | - os_path_join_safe(self.tempdir, 'debian')) |
603 | + join(self.tempdir, 'debian')) |
604 | self.assertEqual( |
605 | self.package.debian_control, |
606 | - os_path_join_safe(self.tempdir, 'debian', 'control')) |
607 | + join(self.tempdir, 'debian', 'control')) |
608 | self.assertEqual( |
609 | self.package.debian_changelog, |
610 | - os_path_join_safe(self.tempdir, 'debian', 'changelog')) |
611 | + join(self.tempdir, 'debian', 'changelog')) |
612 | |
613 | def test_correct_package_changelog(self): |
614 | """Confirm that we can mangle the most recent changelog entry.""" |
615 | @@ -259,7 +258,7 @@ |
616 | @patch('cupstream2distro.packagemanager.call') |
617 | def test_generate_package_diffs_new_source(self, call_mock): |
618 | """Generate correct packaging diff when source is brand new.""" |
619 | - new = os_path_join_safe(self.tempdir, 'new-hotness_2.0.dsc') |
620 | + new = join(self.tempdir, 'new-hotness_2.0.dsc') |
621 | # Only mock the first call; undo the mock for subsequent calls. |
622 | call_mock.side_effect = lambda *ig, **nore: ( |
623 | setattr(packagemanager, 'call', utils.call), |
624 | @@ -280,8 +279,8 @@ |
625 | @patch('cupstream2distro.packagemanager.call') |
626 | def test_generate_package_diffs_no_diff(self, call_mock): |
627 | """Do not generate packaging diff file if there is no diff.""" |
628 | - old = os_path_join_safe(self.tempdir, 'old-busted_1.0.dsc') |
629 | - new = os_path_join_safe(self.tempdir, 'new-hotness_2.0.dsc') |
630 | + old = join(self.tempdir, 'old-busted_1.0.dsc') |
631 | + new = join(self.tempdir, 'new-hotness_2.0.dsc') |
632 | # Only mock the first call; undo the mock for subsequent calls. |
633 | call_mock.side_effect = lambda *ig, **nore: ( |
634 | setattr(packagemanager, 'call', utils.call), |
635 | @@ -298,8 +297,8 @@ |
636 | @patch('cupstream2distro.packagemanager.call') |
637 | def test_generate_package_diffs_bluez(self, call_mock): |
638 | """Find packaging changes in a recent bluez landing.""" |
639 | - old = os_path_join_safe(self.tempdir, 'old-busted_1.0.dsc') |
640 | - new = os_path_join_safe(self.tempdir, 'new-hotness_2.0.dsc') |
641 | + old = join(self.tempdir, 'old-busted_1.0.dsc') |
642 | + new = join(self.tempdir, 'new-hotness_2.0.dsc') |
643 | # Only mock the first call; undo the mock for subsequent calls. |
644 | call_mock.side_effect = lambda *ig, **nore: ( |
645 | setattr(packagemanager, 'call', utils.call), |
646 | @@ -319,8 +318,8 @@ |
647 | @patch('cupstream2distro.packagemanager.call') |
648 | def test_generate_package_diffs_bluez_with_binary(self, call_mock, binary): |
649 | """Find packaging changes in a recent bluez landing, new binaries.""" |
650 | - old = os_path_join_safe(self.tempdir, 'old-busted_1.0.dsc') |
651 | - new = os_path_join_safe(self.tempdir, 'new-hotness_2.0.dsc') |
652 | + old = join(self.tempdir, 'old-busted_1.0.dsc') |
653 | + new = join(self.tempdir, 'new-hotness_2.0.dsc') |
654 | binary.return_value = ['bluez'] |
655 | # Only mock the first call; undo the mock for subsequent calls. |
656 | call_mock.side_effect = lambda *ig, **nore: ( |
657 | @@ -344,8 +343,8 @@ |
658 | @patch('cupstream2distro.packagemanager.call') |
659 | def test_generate_package_diffs_with_component(self, call_mock, binary): |
660 | """Find packaging changes in a recent bluez landing, new binaries.""" |
661 | - old = os_path_join_safe(self.tempdir, 'old-busted_1.0.dsc') |
662 | - new = os_path_join_safe(self.tempdir, 'new-hotness_2.0.dsc') |
663 | + old = join(self.tempdir, 'old-busted_1.0.dsc') |
664 | + new = join(self.tempdir, 'new-hotness_2.0.dsc') |
665 | binary.return_value = ['bluez'] |
666 | # Only mock the first call; undo the mock for subsequent calls. |
667 | call_mock.side_effect = lambda *ig, **nore: ( |
668 | @@ -376,10 +375,9 @@ |
669 | |
670 | def test_collect_bugs_extras(self): |
671 | """Extras syntax case: some bugs in an unreleased changelog.""" |
672 | - path = os_path_join_safe( |
673 | - self.changelogs_file_dir, 'different_bugs_pattern') |
674 | + path = join(self.changelogs_dir, 'different_bugs_pattern') |
675 | self.package.name = 'foo' |
676 | - with patch('cupstream2distro.packagemanager.os_path_join_safe', |
677 | + with patch('cupstream2distro.packagemanager.join', |
678 | lambda *ignore: path): |
679 | self.assertEqual( |
680 | self.package.collect_package_bugs(), |
681 | @@ -394,20 +392,18 @@ |
682 | |
683 | def test_collect_bugs_no_unrelease_no_manual(self): |
684 | """No manual upload, no unreleased changelog.""" |
685 | - path = os_path_join_safe( |
686 | - self.changelogs_file_dir, 'no_unrelease_no_manual') |
687 | + path = join(self.changelogs_dir, 'no_unrelease_no_manual') |
688 | self.package.name = 'foo' |
689 | - with patch('cupstream2distro.packagemanager.os_path_join_safe', |
690 | + with patch('cupstream2distro.packagemanager.join', |
691 | lambda *ignore: path): |
692 | self.assertEqual( |
693 | self.package.collect_package_bugs(), set()) |
694 | |
695 | def test_collect_bugs_multiple_unrelease(self): |
696 | """No bug from it in the first snapshot.""" |
697 | - path = os_path_join_safe( |
698 | - self.changelogs_file_dir, 'multiple_unrelease') |
699 | + path = join(self.changelogs_dir, 'multiple_unrelease') |
700 | self.package.name = 'foo' |
701 | - with patch('cupstream2distro.packagemanager.os_path_join_safe', |
702 | + with patch('cupstream2distro.packagemanager.join', |
703 | lambda *ignore: path): |
704 | self.assertEqual( |
705 | self.package.collect_package_bugs(), |
706 | @@ -415,30 +411,27 @@ |
707 | |
708 | def test_collect_bugs_multiple_unrelease_manual_upload(self): |
709 | """Only collect bugs until the last manual upload.""" |
710 | - path = os_path_join_safe( |
711 | - self.changelogs_file_dir, 'multiple_unrelease_with_release') |
712 | + path = join(self.changelogs_dir, 'multiple_unrelease_with_release') |
713 | self.package.name = 'foo' |
714 | - with patch('cupstream2distro.packagemanager.os_path_join_safe', |
715 | + with patch('cupstream2distro.packagemanager.join', |
716 | lambda *ignore: path): |
717 | self.assertEqual( |
718 | self.package.collect_package_bugs(), set(['23456'])) |
719 | |
720 | def test_collect_bugs_only_one_unreleased_changelog(self): |
721 | """Collect the bugs from the one unreleased changelog.""" |
722 | - path = os_path_join_safe( |
723 | - self.changelogs_file_dir, 'one_unreleased') |
724 | + path = join(self.changelogs_dir, 'one_unreleased') |
725 | self.package.name = 'foo' |
726 | - with patch('cupstream2distro.packagemanager.os_path_join_safe', |
727 | + with patch('cupstream2distro.packagemanager.join', |
728 | lambda *ignore: path): |
729 | self.assertEqual( |
730 | self.package.collect_package_bugs(), set(['12345'])) |
731 | |
732 | def test_collect_bugs_only_one_unreleased_changelog_no_bug(self): |
733 | """We have no bug from the only one unreleased changelog.""" |
734 | - path = os_path_join_safe( |
735 | - self.changelogs_file_dir, 'one_unreleased_no_bug') |
736 | + path = join(self.changelogs_dir, 'one_unreleased_no_bug') |
737 | self.package.name = 'foo' |
738 | - with patch('cupstream2distro.packagemanager.os_path_join_safe', |
739 | + with patch('cupstream2distro.packagemanager.join', |
740 | lambda *ignore: path): |
741 | self.assertEqual(self.package.collect_package_bugs(), set()) |
742 | |
743 | @@ -449,18 +442,16 @@ |
744 | self.package.series.name = 'raring' |
745 | self.package.update_package_changelog( |
746 | '1.2daily83.09.14-0ubuntu1', authors) |
747 | - result_file = os_path_join_safe( |
748 | - self.result_dir, 'simple_changelog_update') |
749 | - self.assert_changelogs_identical(result_file, changelog) |
750 | + res = join(self.result_dir, 'simple_changelog_update') |
751 | + self.assert_changelogs_identical(res, changelog) |
752 | |
753 | def test_update_changelog_nochange(self): |
754 | """Correctly indicate a no-change rebuild.""" |
755 | changelog = self.prep_debian_file('changelog', s.DUMMY_CHANGELOG) |
756 | self.package.series.name = 'raring' |
757 | self.package.update_package_changelog('1.2daily83.09.14-0ubuntu1', {}) |
758 | - result_file = os_path_join_safe( |
759 | - self.result_dir, 'simple_changelog_nochange') |
760 | - self.assert_changelogs_identical(result_file, changelog) |
761 | + res = join(self.result_dir, 'simple_changelog_nochange') |
762 | + self.assert_changelogs_identical(res, changelog) |
763 | |
764 | def test_update_changelog_unicode(self): |
765 | """Update a changelog from one author with a bug and bzr rev.""" |
766 | @@ -469,9 +460,8 @@ |
767 | self.package.series.name = 'raring' |
768 | self.package.update_package_changelog( |
769 | '1.2daily83.09.14-0ubuntu1', authors) |
770 | - result_file = os_path_join_safe( |
771 | - self.result_dir, 'unicode_changelog_update') |
772 | - self.assert_changelogs_identical(result_file, changelog) |
773 | + res = join(self.result_dir, 'unicode_changelog_update') |
774 | + self.assert_changelogs_identical(res, changelog) |
775 | |
776 | def test_update_changelog_one_author_multiple_bugs(self): |
777 | """Update a changelog from a list of one author with multiple bugs.""" |
778 | @@ -482,9 +472,9 @@ |
779 | self.package.series.name = 'raring' |
780 | self.package.update_package_changelog( |
781 | '1.2daily83.09.14-0ubuntu1', authors) |
782 | - result_file = os_path_join_safe( |
783 | + res = join( |
784 | self.result_dir, 'multiple_bugs_one_author_changelog_update') |
785 | - self.assert_changelogs_identical(result_file, changelog) |
786 | + self.assert_changelogs_identical(res, changelog) |
787 | |
788 | def test_update_changelog_multiple_authors(self): |
789 | """Update a changelog from multiple authors with multiple bugs.""" |
790 | @@ -497,9 +487,8 @@ |
791 | self.package.series.name = 'raring' |
792 | self.package.update_package_changelog( |
793 | '1.2daily83.09.14-0ubuntu1', authors) |
794 | - result_file = os_path_join_safe( |
795 | - self.result_dir, 'multiple_authors_bugs_changelog_update') |
796 | - self.assert_changelogs_identical(result_file, changelog) |
797 | + res = join(self.result_dir, 'multiple_authors_bugs_changelog_update') |
798 | + self.assert_changelogs_identical(res, changelog) |
799 | |
800 | def test_update_changelog_with_msg_starting_with_dash(self): |
801 | """Update a changelog with a message starting with '-'.""" |
802 | @@ -508,9 +497,8 @@ |
803 | self.package.series.name = 'raring' |
804 | self.package.update_package_changelog( |
805 | '42.0daily83.09.14-0ubuntu1', authors) |
806 | - result_file = os_path_join_safe( |
807 | - self.result_dir, 'message_starting_with_dash') |
808 | - self.assert_changelogs_identical(result_file, changelog) |
809 | + res = join(self.result_dir, 'message_starting_with_dash') |
810 | + self.assert_changelogs_identical(res, changelog) |
811 | |
812 | def test_update_changelog_with_existing_content(self): |
813 | """Update a changelog when we already have existing content.""" |
814 | @@ -523,9 +511,8 @@ |
815 | self.package.series.name = 'raring' |
816 | self.package.update_package_changelog( |
817 | '42.0daily83.09.14-0ubuntu1', authors) |
818 | - result_file = os_path_join_safe( |
819 | - self.result_dir, 'existing_content_changelog_update') |
820 | - self.assert_changelogs_identical(result_file, changelog) |
821 | + res = join(self.result_dir, 'existing_content_changelog_update') |
822 | + self.assert_changelogs_identical(res, changelog) |
823 | |
824 | def test_update_changelog_with_existing_content_existing_author(self): |
825 | """Update a changelog when we already have existing author.""" |
826 | @@ -539,9 +526,8 @@ |
827 | self.package.series.name = 'raring' |
828 | self.package.update_package_changelog( |
829 | '42.0daily83.09.14-0ubuntu1', authors) |
830 | - result_file = os_path_join_safe( |
831 | - self.result_dir, 'existing_content_author_changelog_update') |
832 | - self.assert_changelogs_identical(result_file, changelog) |
833 | + res = join(self.result_dir, 'existing_content_author_changelog_update') |
834 | + self.assert_changelogs_identical(res, changelog) |
835 | |
836 | def test_update_changelog_with_existing_content_existing_multiple_authors( |
837 | self): |
838 | @@ -555,10 +541,10 @@ |
839 | self.package.series.name = 'raring' |
840 | self.package.update_package_changelog( |
841 | '42.0daily83.09.14-0ubuntu1', authors) |
842 | - result_file = os_path_join_safe( |
843 | + res = join( |
844 | self.result_dir, |
845 | 'existing_content_multiple_authors_changelog_update') |
846 | - self.assert_changelogs_identical(result_file, changelog) |
847 | + self.assert_changelogs_identical(res, changelog) |
848 | |
849 | @patch('cupstream2distro.packagemanager.log_call') |
850 | def test_update_changelog_failure(self, lc_mock): |
851 | @@ -586,10 +572,8 @@ |
852 | changelog = self.prep_debian_file('changelog', s.BASE_CHANGELOG) |
853 | symbols = self.prep_debian_file('foo.symbols', s.BASIC_SYMBOLS) |
854 | self.package.refresh_package_versions('42.0daily83.09.14-0ubuntu1') |
855 | - result_symbols = os_path_join_safe( |
856 | - self.result_dir, 'simple_update.symbols') |
857 | - result_changelog = os_path_join_safe( |
858 | - self.result_dir, 'simple_foo_update.changelog') |
859 | + result_symbols = join(self.result_dir, 'simple_update.symbols') |
860 | + result_changelog = join(self.result_dir, 'simple_foo_update.changelog') |
861 | self.assert_files_identical(symbols, result_symbols) |
862 | self.assert_changelogs_identical(result_changelog, changelog) |
863 | |
864 | @@ -598,10 +582,9 @@ |
865 | changelog = self.prep_debian_file('changelog', s.BASE_CHANGELOG) |
866 | symbols = self.prep_debian_file('foo.symbols', s.MULTIPLE_SYMBOLS) |
867 | self.package.refresh_package_versions('42.0daily83.09.14-0ubuntu1') |
868 | - result_symbols = os_path_join_safe( |
869 | + result_symbols = join( |
870 | self.result_dir, 'multiplesymbols_update.symbols') |
871 | - result_changelog = os_path_join_safe( |
872 | - self.result_dir, 'simple_foo_update.changelog') |
873 | + result_changelog = join(self.result_dir, 'simple_foo_update.changelog') |
874 | self.assert_files_identical(symbols, result_symbols) |
875 | self.assert_changelogs_identical(result_changelog, changelog) |
876 | |
877 | @@ -611,9 +594,8 @@ |
878 | 'changelog', s.BASIC_SYMBOLS_WITH_CHANGELOG) |
879 | symbols = self.prep_debian_file('foo.symbols', s.BASIC_SYMBOLS) |
880 | self.package.refresh_package_versions('42.0daily83.09.14-0ubuntu1') |
881 | - result_symbols = os_path_join_safe( |
882 | - self.result_dir, 'simple_update.symbols') |
883 | - result_changelog = os_path_join_safe( |
884 | + result_symbols = join(self.result_dir, 'simple_update.symbols') |
885 | + result_changelog = join( |
886 | self.result_dir, |
887 | 'simple_foo_update_with_existing_content.changelog') |
888 | self.assert_files_identical(symbols, result_symbols) |
889 | @@ -642,10 +624,9 @@ |
890 | foos = self.prep_debian_file('foo.symbols', s.MULTIPLE_SYMBOLS) |
891 | bars = self.prep_debian_file('bar.symbols', s.MULTIPLE_SYMBOLS) |
892 | self.package.refresh_package_versions('42.0daily83.09.14-0ubuntu1') |
893 | - result_symbols = os_path_join_safe( |
894 | + result_symbols = join( |
895 | self.result_dir, 'multiplesymbols_update.symbols') |
896 | - result_changelog = os_path_join_safe( |
897 | - self.result_dir, 'multiple_update.changelog') |
898 | + result_changelog = join(self.result_dir, 'multiple_update.changelog') |
899 | self.assert_files_identical(foos, result_symbols) |
900 | self.assert_files_identical(bars, result_symbols) |
901 | self.assert_changelogs_identical(result_changelog, changelog) |
902 | @@ -655,10 +636,8 @@ |
903 | changelog = self.prep_debian_file('changelog', s.BASE_CHANGELOG) |
904 | symbols = self.prep_debian_file('symbols', s.BASIC_SYMBOLS) |
905 | self.package.refresh_package_versions('42.0daily83.09.14-0ubuntu1') |
906 | - result_symbols = os_path_join_safe( |
907 | - self.result_dir, 'simple_update.symbols') |
908 | - result_changelog = os_path_join_safe( |
909 | - self.result_dir, 'simple_update.changelog') |
910 | + result_symbols = join(self.result_dir, 'simple_update.symbols') |
911 | + result_changelog = join(self.result_dir, 'simple_update.changelog') |
912 | self.assert_files_identical(symbols, result_symbols) |
913 | self.assert_changelogs_identical(result_changelog, changelog) |
914 | |
915 | @@ -667,9 +646,8 @@ |
916 | changelog = self.prep_debian_file('changelog', s.BASE_CHANGELOG) |
917 | symbols = self.prep_debian_file('foo.symbols.amd64', s.BASIC_SYMBOLS) |
918 | self.package.refresh_package_versions('42.0daily83.09.14-0ubuntu1') |
919 | - result_symbols = os_path_join_safe( |
920 | - self.result_dir, 'simple_update.symbols') |
921 | - result_changelog = os_path_join_safe( |
922 | + result_symbols = join(self.result_dir, 'simple_update.symbols') |
923 | + result_changelog = join( |
924 | self.result_dir, 'simple_update_arch.changelog') |
925 | self.assert_changelogs_identical(result_changelog, changelog) |
926 | self.assert_files_identical(symbols, result_symbols) |
927 | @@ -679,9 +657,8 @@ |
928 | changelog = self.prep_debian_file('changelog', s.BASE_CHANGELOG) |
929 | symbols = self.prep_debian_file('symbols.amd64', s.BASIC_SYMBOLS) |
930 | self.package.refresh_package_versions('42.0daily83.09.14-0ubuntu1') |
931 | - result_symbols = os_path_join_safe( |
932 | - self.result_dir, 'simple_update.symbols') |
933 | - result_changelog = os_path_join_safe( |
934 | + result_symbols = join(self.result_dir, 'simple_update.symbols') |
935 | + result_changelog = join( |
936 | self.result_dir, 'simple_update_alone_arch.changelog') |
937 | self.assert_files_identical(symbols, result_symbols) |
938 | self.assert_changelogs_identical(result_changelog, changelog) |
939 | @@ -689,8 +666,7 @@ |
940 | def test_dont_refresh_symbols_files_for_directory(self): |
941 | """We don't fail for directories under debian/.""" |
942 | self.prep_debian_file('changelog', s.DUMMY_CHANGELOG) |
943 | - debian_source_path = os_path_join_safe( |
944 | - self.tempdir, 'debian', 'source') |
945 | + debian_source_path = join(self.tempdir, 'debian', 'source') |
946 | os.mkdir(debian_source_path) |
947 | self.package.refresh_package_versions('42.0daily83.09.14-0ubuntu1') |
948 | self.assertTrue(os.path.isdir(debian_source_path)) |
949 | @@ -699,8 +675,7 @@ |
950 | """We don't touch symlinks under debian/.""" |
951 | self.prep_debian_file('changelog', s.BASE_CHANGELOG) |
952 | self.prep_debian_file('foo.symbols', s.BASIC_SYMBOLS) |
953 | - symlink_path = os_path_join_safe( |
954 | - self.tempdir, 'debian', 'foo.symbols.link') |
955 | + symlink_path = join(self.tempdir, 'debian', 'foo.symbols.link') |
956 | os.symlink('foo.symbols', symlink_path) |
957 | self.package.refresh_package_versions('42.0daily83.09.14-0ubuntu1') |
958 | self.assertTrue(os.path.islink(symlink_path)) |
959 | |
960 | === modified file 'tests/unit/test_project.py' |
961 | --- tests/unit/test_project.py 2015-08-22 03:33:11 +0000 |
962 | +++ tests/unit/test_project.py 2015-09-10 02:16:41 +0000 |
963 | @@ -18,9 +18,10 @@ |
964 | |
965 | from tests.unit import DirectoryAwareTestCase |
966 | |
967 | +from os.path import join |
968 | from cupstream2distro import project |
969 | from cupstream2distro.project import DotProject |
970 | -from cupstream2distro.utils import env, os_path_join_safe, utf8_open |
971 | +from cupstream2distro.utils import env, utf8_open |
972 | |
973 | import os |
974 | import shutil |
975 | @@ -31,7 +32,7 @@ |
976 | def setUp(self): |
977 | """Mock out SILO_DIR and SILOS_DIR for testing.""" |
978 | super().setUp() |
979 | - project.SILO_DIR = lambda: self.tempdir |
980 | + project.SILO_DIR = lambda *parts: join(self.tempdir, *parts) |
981 | env.SILONAME = '' |
982 | |
983 | def test_file_creation(self): |
984 | @@ -39,8 +40,8 @@ |
985 | proj = DotProject('hello') |
986 | proj.write() |
987 | self.assertTrue(os.path.isfile( |
988 | - os_path_join_safe(self.tempdir, 'hello.project'))) |
989 | - path = os_path_join_safe(self.tempdir, 'hello.project') |
990 | + join(self.tempdir, 'hello.project'))) |
991 | + path = join(self.tempdir, 'hello.project') |
992 | with utf8_open(path) as data: |
993 | self.assertEqual(data.readlines(), []) |
994 | |
995 | @@ -50,7 +51,7 @@ |
996 | proj.dest_current_version = '0.99.alpha+15.04.20141225-0ubuntu1' |
997 | proj.packaging_version = '1.0+15.04.20150101-0ubuntu1' |
998 | proj.write() |
999 | - path = os_path_join_safe(self.tempdir, 'yeehaw.project') |
1000 | + path = join(self.tempdir, 'yeehaw.project') |
1001 | with utf8_open(path) as data: |
1002 | self.assertEqual(data.readlines(), [ |
1003 | '[Package]\n', |
1004 | @@ -63,7 +64,7 @@ |
1005 | """Does the soft_save method create the expected values in the file?""" |
1006 | DotProject.soft_save( |
1007 | 'yessir', dest='0.1', ours='0.2') |
1008 | - path = os_path_join_safe(self.tempdir, 'yessir.project') |
1009 | + path = join(self.tempdir, 'yessir.project') |
1010 | with utf8_open(path) as data: |
1011 | self.assertEqual(data.readlines(), [ |
1012 | '[Package]\n', |
1013 | @@ -75,7 +76,7 @@ |
1014 | def test_soft_save_initial_with_blanks(self): |
1015 | """Does soft_save create the expected blank values in the file?""" |
1016 | DotProject.soft_save('yessir', dest='', ours='0.2') |
1017 | - path = os_path_join_safe(self.tempdir, 'yessir.project') |
1018 | + path = join(self.tempdir, 'yessir.project') |
1019 | with utf8_open(path) as data: |
1020 | self.assertEqual(data.readlines(), [ |
1021 | '[Package]\n', |
1022 | @@ -88,7 +89,7 @@ |
1023 | """Does a second call to soft_save preserve original values?""" |
1024 | DotProject.soft_save('yessir', dest='0.1', ours='0.2') |
1025 | DotProject.soft_save('yessir', ours='0.3') |
1026 | - path = os_path_join_safe(self.tempdir, 'yessir.project') |
1027 | + path = join(self.tempdir, 'yessir.project') |
1028 | with utf8_open(path) as data: |
1029 | self.assertEqual(data.readlines(), [ |
1030 | '[Package]\n', |
1031 | @@ -99,7 +100,7 @@ |
1032 | |
1033 | def test_file_reading(self): |
1034 | """If we create a file manually, can DotProject read those values?""" |
1035 | - path = os_path_join_safe(self.tempdir, 'fuddy.project') |
1036 | + path = join(self.tempdir, 'fuddy.project') |
1037 | with utf8_open(path, 'w') as data: |
1038 | data.write( |
1039 | '[Package]\n' |
1040 | @@ -114,7 +115,7 @@ |
1041 | def test_get_previous_distro_version_from_config(self): |
1042 | """Can we access dest_current_version?""" |
1043 | shutil.copy2( |
1044 | - os_path_join_safe(self.project_file_dir, 'foo.project'), |
1045 | + join(self.project_file_dir, 'foo.project'), |
1046 | self.tempdir) |
1047 | self.assertEqual( |
1048 | DotProject('foo').dest_current_version, |
1049 | @@ -123,7 +124,7 @@ |
1050 | def test_get_all_packages_uploaded(self): |
1051 | """Does get_all_packages_uploaded find one file?""" |
1052 | shutil.copy2( |
1053 | - os_path_join_safe(self.project_file_dir, 'foo.project'), |
1054 | + join(self.project_file_dir, 'foo.project'), |
1055 | self.tempdir) |
1056 | self.assertEqual( |
1057 | DotProject.get_all_packages_uploaded(), |
1058 | @@ -132,9 +133,9 @@ |
1059 | def test_get_all_packages_uploaded_multi(self): |
1060 | """Does get_all_packages_uploaded find three files?""" |
1061 | shutil.copy2( |
1062 | - os_path_join_safe(self.project_file_dir, 'foo.project'), |
1063 | + join(self.project_file_dir, 'foo.project'), |
1064 | self.tempdir) |
1065 | - path = os_path_join_safe(self.tempdir, 'f.project') |
1066 | + path = join(self.tempdir, 'f.project') |
1067 | with utf8_open(path, 'w') as data: |
1068 | data.write( |
1069 | '[Package]\n' |
1070 | @@ -155,10 +156,10 @@ |
1071 | |
1072 | def test_mark_project_as_published(self): |
1073 | """Confirm project file creation to avoid re-publishing projects.""" |
1074 | - shutil.copy2(os_path_join_safe(self.project_file_dir, 'foo.project'), |
1075 | + shutil.copy2(join(self.project_file_dir, 'foo.project'), |
1076 | self.tempdir) |
1077 | DotProject('foo').mark_as_published('4.2dailysomething-0ubuntu1') |
1078 | - filename = os_path_join_safe(self.tempdir, 'foo.project') |
1079 | + filename = join(self.tempdir, 'foo.project') |
1080 | self.assertTrue(os.path.isfile(filename)) |
1081 | with utf8_open(filename) as data: |
1082 | self.assertEqual(data.readlines(), [ |
1083 | @@ -171,10 +172,10 @@ |
1084 | |
1085 | def test_mark_project_and_diff_as_published(self): |
1086 | """Confirm diff file creation to prevent project republishing.""" |
1087 | - shutil.copy2(os_path_join_safe(self.project_file_dir, 'foo.project'), |
1088 | + shutil.copy2(join(self.project_file_dir, 'foo.project'), |
1089 | self.tempdir) |
1090 | - shutil.copy2(os_path_join_safe(self.project_file_dir, 'foo.project'), |
1091 | - os_path_join_safe( |
1092 | + shutil.copy2(join(self.project_file_dir, 'foo.project'), |
1093 | + join( |
1094 | self.tempdir, 'packaging_changes_foo_4.2' |
1095 | 'dailysomething-0ubuntu1.diff')) |
1096 | DotProject('foo').mark_as_published('4.2dailysomething-0ubuntu1') |
1097 | |
1098 | === modified file 'tests/unit/test_recipe_base.py' |
1099 | --- tests/unit/test_recipe_base.py 2015-09-09 00:14:07 +0000 |
1100 | +++ tests/unit/test_recipe_base.py 2015-09-10 02:16:41 +0000 |
1101 | @@ -16,6 +16,7 @@ |
1102 | |
1103 | """Tests for CI Train Build script.""" |
1104 | |
1105 | +from os.path import join |
1106 | from pprint import pprint |
1107 | from mock import Mock, call, patch |
1108 | |
1109 | @@ -27,7 +28,7 @@ |
1110 | DEPWAIT_TIMEOUT as DW, |
1111 | PPA_TIMEOUT as PT, |
1112 | ) |
1113 | -from cupstream2distro.utils import env, os_path_join_safe |
1114 | +from cupstream2distro.utils import env |
1115 | from cupstream2distro.errors import ( |
1116 | BuildError, |
1117 | CITrainError, |
1118 | @@ -378,7 +379,7 @@ |
1119 | with patch('cupstream2distro.utils.SILOS_DIR', self.tempdir): |
1120 | build.diff_phase() |
1121 | build.get_from_archive.assert_called_once_with( |
1122 | - os_path_join_safe(self.tempdir, 'ubuntu', 'bar'), |
1123 | + join(self.tempdir, 'ubuntu', 'bar'), |
1124 | archive=build.dest, |
1125 | status='Published') |
1126 | build.generate_package_diffs.assert_called_once_with( |
1127 | @@ -399,7 +400,7 @@ |
1128 | with patch('cupstream2distro.utils.SILOS_DIR', self.tempdir): |
1129 | build.diff_phase() |
1130 | build.get_from_archive.assert_called_once_with( |
1131 | - os_path_join_safe(self.tempdir, 'ubuntu', 'bar'), |
1132 | + join(self.tempdir, 'ubuntu', 'bar'), |
1133 | archive=build.dest, |
1134 | status='Published') |
1135 | build.generate_package_diffs.assert_called_once_with(None, 'new_dsc') |
1136 | @@ -420,7 +421,7 @@ |
1137 | with patch('cupstream2distro.utils.SILOS_DIR', self.tempdir): |
1138 | build.diff_phase() |
1139 | build.get_from_archive.assert_called_once_with( |
1140 | - os_path_join_safe(self.tempdir, 'ubuntu', 'bar'), |
1141 | + join(self.tempdir, 'ubuntu', 'bar'), |
1142 | archive=build.main_archive, |
1143 | status='Published') |
1144 | build.generate_package_diffs.assert_called_once_with(None, 'new_dsc') |
1145 | |
1146 | === modified file 'tests/unit/test_recipe_secondary.py' |
1147 | --- tests/unit/test_recipe_secondary.py 2015-08-21 06:28:34 +0000 |
1148 | +++ tests/unit/test_recipe_secondary.py 2015-09-10 02:16:41 +0000 |
1149 | @@ -16,12 +16,13 @@ |
1150 | |
1151 | """Tests for CI Train Secondary Recipe.""" |
1152 | |
1153 | +from os.path import join |
1154 | from mock import Mock, patch |
1155 | |
1156 | from tests.unit import DirectoryAwareTestCase |
1157 | |
1158 | from citrain.recipes.secondary import Secondary |
1159 | -from cupstream2distro.utils import env, os_path_join_safe |
1160 | +from cupstream2distro.utils import env |
1161 | |
1162 | |
1163 | MOD = 'citrain.recipes.secondary.' |
1164 | @@ -52,7 +53,7 @@ |
1165 | lp_mock.load.assert_called_once_with( |
1166 | self.series.previous_series_link) |
1167 | self.assertEqual( |
1168 | - sec.path, os_path_join_safe(self.tempdir, 'foo_+vivid')) |
1169 | + sec.path, join(self.tempdir, 'foo_+vivid')) |
1170 | sec.clean_phase() |
1171 | sec.upload_phase() |
1172 | sec.diff_phase() |
1173 | @@ -79,8 +80,8 @@ |
1174 | sec.get_package_version.return_value = '0+15.10.20150525-0ubuntu1' |
1175 | sec.collect_phase() |
1176 | sh_mock.copytree.assert_called_once_with( |
1177 | - os_path_join_safe(self.tempdir, 'foo'), |
1178 | - os_path_join_safe(self.tempdir, 'foo_+vivid'), |
1179 | + join(self.tempdir, 'foo'), |
1180 | + join(self.tempdir, 'foo_+vivid'), |
1181 | symlinks=True) |
1182 | sec.correct_package_changelog.assert_called_once_with( |
1183 | '0+15.04.20150525-0ubuntu1', 'vivid') |
1184 | |
1185 | === modified file 'tests/unit/test_revno.py' |
1186 | --- tests/unit/test_revno.py 2015-08-30 08:24:36 +0000 |
1187 | +++ tests/unit/test_revno.py 2015-09-10 02:16:41 +0000 |
1188 | @@ -16,10 +16,12 @@ |
1189 | |
1190 | """Tests for .revno file logic.""" |
1191 | |
1192 | +from os.path import join |
1193 | + |
1194 | from tests.unit import BaseTestCase |
1195 | |
1196 | from cupstream2distro import revno |
1197 | -from cupstream2distro.utils import os_path_join_safe, utf8_open |
1198 | +from cupstream2distro.utils import utf8_open |
1199 | from cupstream2distro.errors import PublishError |
1200 | |
1201 | |
1202 | @@ -29,7 +31,7 @@ |
1203 | def setUp(self): |
1204 | """Set SILO_DIR to tempdir so we can create files safely.""" |
1205 | super().setUp() |
1206 | - revno.SILO_DIR = lambda *p: os_path_join_safe(self.tempdir, *p) |
1207 | + revno.SILO_DIR = lambda *parts: join(self.tempdir, *parts) |
1208 | |
1209 | def test_init(self): |
1210 | """Class can be instantiated with expected values.""" |
1211 | |
1212 | === modified file 'tests/unit/test_script_migration.py' |
1213 | --- tests/unit/test_script_migration.py 2015-09-09 22:10:41 +0000 |
1214 | +++ tests/unit/test_script_migration.py 2015-09-10 02:16:41 +0000 |
1215 | @@ -16,12 +16,12 @@ |
1216 | |
1217 | """Tests for CI Train Migration script.""" |
1218 | |
1219 | +from os.path import join |
1220 | from mock import Mock, call |
1221 | |
1222 | from tests.unit import CITrainScriptTestCase |
1223 | |
1224 | from cupstream2distro.settings import SILOS_DIR |
1225 | -from cupstream2distro.utils import os_path_join_safe |
1226 | from cupstream2distro.errors import MigrationError |
1227 | |
1228 | # Unused import necessary for code coverage reporting |
1229 | @@ -38,7 +38,7 @@ |
1230 | self.script.MergeManager = Mock() |
1231 | self.script.merge_main = Mock() |
1232 | self.script.glob.return_value = [ |
1233 | - os_path_join_safe(SILOS_DIR, 'ubuntu', 'landing-00{}'.format(x)) |
1234 | + join(SILOS_DIR, 'ubuntu', 'landing-00{}'.format(x)) |
1235 | for x in range(3)] |
1236 | |
1237 | def test_main(self): |
1238 | |
1239 | === modified file 'tests/unit/test_script_prepare_silo.py' |
1240 | --- tests/unit/test_script_prepare_silo.py 2015-09-09 00:14:07 +0000 |
1241 | +++ tests/unit/test_script_prepare_silo.py 2015-09-10 02:16:41 +0000 |
1242 | @@ -16,12 +16,12 @@ |
1243 | |
1244 | """Tests for CI Train Prepare script.""" |
1245 | |
1246 | -from os.path import expanduser |
1247 | +from os.path import expanduser, join |
1248 | from mock import Mock, call |
1249 | from os import environ |
1250 | |
1251 | from cupstream2distro import project |
1252 | -from cupstream2distro.utils import env, os_path_join_safe |
1253 | +from cupstream2distro.utils import env |
1254 | from cupstream2distro.errors import PrepError |
1255 | |
1256 | from tests.unit import CITrainScriptTestCase |
1257 | @@ -51,7 +51,7 @@ |
1258 | self.script.glob.return_value = ['a', 'b', 'c'] |
1259 | self.clean_source('friggle') |
1260 | self.assertEqual(self.script.shutil.rmtree.mock_calls, [ |
1261 | - call(os_path_join_safe(self.tempdir, 'friggle')), |
1262 | + call(join(self.tempdir, 'friggle')), |
1263 | ]) |
1264 | self.assertEqual( |
1265 | self.script.os.remove.mock_calls, [ |
1266 | @@ -65,7 +65,7 @@ |
1267 | self.script.os.remove.side_effect = OSError('Is a directory') |
1268 | self.clean_source('friggle') |
1269 | self.assertEqual(self.script.shutil.rmtree.mock_calls, [ |
1270 | - call(os_path_join_safe(self.tempdir, 'friggle')), |
1271 | + call(join(self.tempdir, 'friggle')), |
1272 | call('a'), call('b'), call('c'), |
1273 | ]) |
1274 | self.assertEqual( |
1275 | |
1276 | === modified file 'tests/unit/test_script_setup_citrain.py' |
1277 | --- tests/unit/test_script_setup_citrain.py 2015-09-05 01:42:54 +0000 |
1278 | +++ tests/unit/test_script_setup_citrain.py 2015-09-10 02:16:41 +0000 |
1279 | @@ -20,12 +20,13 @@ |
1280 | import glob |
1281 | import json |
1282 | |
1283 | +from os.path import join |
1284 | from mock import Mock, call |
1285 | from collections import defaultdict |
1286 | |
1287 | from tests.unit import CITrainScriptTestCase |
1288 | |
1289 | -from cupstream2distro.utils import os_path_join_safe, utf8_open |
1290 | +from cupstream2distro.utils import utf8_open |
1291 | from cupstream2distro.settings import PPA_TEAM, read_silo_names |
1292 | |
1293 | # Unused import necessary for code coverage reporting |
1294 | @@ -39,7 +40,7 @@ |
1295 | |
1296 | def test_read_silo_names(self): |
1297 | """Ensure that we can read the silo name list from disk.""" |
1298 | - listfile = os_path_join_safe(self.tempdir, 'list') |
1299 | + listfile = join(self.tempdir, 'list') |
1300 | expected = ['ubuntu/one', 'ubuntu/two'] |
1301 | with utf8_open(listfile, 'w') as data: |
1302 | data.write(json.dumps(expected)) |
1303 | @@ -89,7 +90,7 @@ |
1304 | self.script.JOBS_DIR = self.tempdir |
1305 | self.script.os.makedirs = os.makedirs |
1306 | self.script.setup_job('prepare-silo') |
1307 | - config = os_path_join_safe(self.tempdir, 'prepare-silo', 'config.xml') |
1308 | + config = join(self.tempdir, 'prepare-silo', 'config.xml') |
1309 | with utf8_open(config) as data: |
1310 | self.assertEqual(data.read(), 'hello there!') |
1311 | self.script.load_template.assert_called_once_with( |
1312 | @@ -168,7 +169,7 @@ |
1313 | self.script.JOBS_DIR = self.tempdir |
1314 | self.script.os.makedirs = os.makedirs |
1315 | self.assertEqual(self.script.main(), 0) |
1316 | - result = sorted(glob.glob(os_path_join_safe(self.tempdir, '*', '*'))) |
1317 | + result = sorted(glob.glob(join(self.tempdir, '*', '*'))) |
1318 | self.assertEqual(len(result), len(expected)) |
1319 | for expectation in expected: |
1320 | - self.assertIn(os_path_join_safe(self.tempdir, expectation), result) |
1321 | + self.assertIn(join(self.tempdir, expectation), result) |
1322 | |
1323 | === modified file 'tests/unit/test_utils.py' |
1324 | --- tests/unit/test_utils.py 2015-09-09 00:14:07 +0000 |
1325 | +++ tests/unit/test_utils.py 2015-09-10 02:16:41 +0000 |
1326 | @@ -18,7 +18,7 @@ |
1327 | |
1328 | import os |
1329 | |
1330 | -from six.moves import range as gen_range |
1331 | +from os.path import join |
1332 | from mock import Mock, patch |
1333 | |
1334 | from cupstream2distro.utils import ( |
1335 | @@ -28,7 +28,6 @@ |
1336 | find_all_uploaded, |
1337 | log_call, |
1338 | name_ppa, |
1339 | - os_path_join_safe, |
1340 | run_script, |
1341 | singleton, |
1342 | utf8_inplace, |
1343 | @@ -120,31 +119,6 @@ |
1344 | env.TESTING = orig |
1345 | self.assertEqual(env.TESTING, result) |
1346 | |
1347 | - def test_os_path_join_safe(self): |
1348 | - """Our os_path_join_safe gives identical results as os.path.join().""" |
1349 | - home = os.path.expanduser('~') |
1350 | - cases = ( |
1351 | - ('',), |
1352 | - (home,), |
1353 | - (home, 'foo'), |
1354 | - [home] + list('abc'), |
1355 | - [os.sep] + [str(i) for i in gen_range(10)], |
1356 | - ) |
1357 | - for case in cases: |
1358 | - self.assertEqual(os_path_join_safe(*case), os.path.join(*case)) |
1359 | - |
1360 | - def test_os_path_join_safe_exception(self): |
1361 | - """But raise an exception when there are too many abs paths.""" |
1362 | - home = os.path.expanduser('~') |
1363 | - cases = ( |
1364 | - (home, home), |
1365 | - (home, os.sep), |
1366 | - (home, 'foo', home), |
1367 | - ) |
1368 | - for case in cases: |
1369 | - with self.assertRaises(AssertionError): |
1370 | - os_path_join_safe(*case) |
1371 | - |
1372 | def test_silo_dir(self): |
1373 | """SILO_DIR() function can find the correct silo dir dynamically.""" |
1374 | env.SILONAME = '' |
1375 | @@ -251,7 +225,7 @@ |
1376 | |
1377 | def test_utf8_inplace_permissions(self): |
1378 | """Ensure utf8_inplace preserves a file's permissions.""" |
1379 | - path = os_path_join_safe(self.tempdir, 'test.sh') |
1380 | + path = join(self.tempdir, 'test.sh') |
1381 | with utf8_open(path, 'w') as data: |
1382 | data.write('#!/bin/sh') |
1383 | os.chmod(path, 0o755) |