Merge ~racb/git-ubuntu:renameabledir-must-exist into git-ubuntu:master

Proposed by Robie Basak
Status: Merged
Merged at revision: 751a070a9560ce530f93cea6ae48d21096b8f179
Proposed branch: ~racb/git-ubuntu:renameabledir-must-exist
Merge into: git-ubuntu:master
Diff against target: 40 lines (+16/-1)
2 files modified
gitubuntu/git_repository.py (+10/-1)
gitubuntu/git_repository_test.py (+6/-0)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Bryce Harrington Approve
Review via email: mp+380862@code.launchpad.net

Commit message

Make Jenkins happy

To post a comment you must log in.
Revision history for this message
Bryce Harrington (bryce) wrote :

I like it!

review: Approve
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:1334cc5d6625a6eb8b7d7907fdde84dfbef11271
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/480/
Executed test runs:
    SUCCESS: VM Setup
    SUCCESS: Build
    SUCCESS: Unit Tests
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/git-ubuntu-ci/480//rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/gitubuntu/git_repository.py b/gitubuntu/git_repository.py
2index 002fa28..a0ae2e6 100644
3--- a/gitubuntu/git_repository.py
4+++ b/gitubuntu/git_repository.py
5@@ -236,8 +236,17 @@ class RenameableDir:
6 :param str path: the on-disk directory to wrap, which must exist. For
7 symlinks, it is the symlink itself that must exist; the existence
8 of a symlink's target does not matter.
9+ :raises FileNotFoundError: if the path supplied does not exist.
10 """
11- assert os.path.lexists(path)
12+ # Ignore the return value of os.lstat(); this call is used to raise
13+ # FileNotFoundError if the path does not exist (as required in the spec
14+ # specified by the docstring), or succeed otherwise. The
15+ # call for os.path.lexists() would use the same underlying system call
16+ # anyway, so this is equivalent and this way we end up with a full
17+ # FileNotFoundError exception created for us with all the correct
18+ # parameters.
19+ os.lstat(path)
20+
21 self._path = path
22
23 @property
24diff --git a/gitubuntu/git_repository_test.py b/gitubuntu/git_repository_test.py
25index 773c947..a212080 100644
26--- a/gitubuntu/git_repository_test.py
27+++ b/gitubuntu/git_repository_test.py
28@@ -341,6 +341,12 @@ def test_renameable_dir_hash_eq(tmpdir):
29 assert rd1a != rd2
30
31
32+def test_renameable_dir_must_exist(tmpdir):
33+ """A RenameableDir should reject a path that doesn't exist"""
34+ with pytest.raises(FileNotFoundError):
35+ target.RenameableDir(tmpdir.join('a'))
36+
37+
38 def test_fake_renameable_dir_basename():
39 path = target.FakeRenameableDir('foo', None)
40 assert path.basename == 'foo'

Subscribers

People subscribed via source and target branches