Merge lp:~joetalbott/utah/vcs_tests_fix into lp:utah

Proposed by Joe Talbott
Status: Merged
Approved by: Javier Collado
Approved revision: 705
Merged at revision: 706
Proposed branch: lp:~joetalbott/utah/vcs_tests_fix
Merge into: lp:utah
Diff against target: 101 lines (+24/-14)
2 files modified
utah/client/tests/test_vcs_bzr.py (+13/-8)
utah/client/tests/test_vcs_git.py (+11/-6)
To merge this branch: bzr merge lp:~joetalbott/utah/vcs_tests_fix
Reviewer Review Type Date Requested Status
Javier Collado (community) Approve
Review via email: mp+129050@code.launchpad.net

Description of the change

Update VCS tests to check the returncode on .get() calls.

To post a comment you must log in.
Revision history for this message
Javier Collado (javier.collado) wrote :

Looks fine.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'utah/client/tests/test_vcs_bzr.py'
2--- utah/client/tests/test_vcs_bzr.py 2012-10-09 15:23:56 +0000
3+++ utah/client/tests/test_vcs_bzr.py 2012-10-10 21:42:22 +0000
4@@ -4,6 +4,7 @@
5
6 from utah.client.common import BzrHandler
7
8+
9 class TestBzrHandler(unittest.TestCase):
10 """
11 Test the bazaar VCS handler.
12@@ -29,11 +30,12 @@
13 directory = "/tmp"
14 path = os.path.join(directory, dest)
15
16- self.assertFalse(os.path.exists(path))
17-
18- bzr.get(directory=directory)
19-
20- self.assertTrue(os.path.exists(path))
21+ self.assertFalse(os.path.exists(path), path)
22+
23+ result = bzr.get(directory=directory)
24+ self.assertEqual(result['returncode'], 0)
25+
26+ self.assertTrue(os.path.exists(path), path)
27 shutil.rmtree(path)
28
29 def test_bzr_revision(self):
30@@ -43,9 +45,12 @@
31 directory = "/tmp"
32 path = os.path.join(directory, dest)
33
34- self.assertFalse(os.path.exists(path))
35- bzr.get(directory=directory)
36- self.assertTrue(os.path.exists(path))
37+ self.assertFalse(os.path.exists(path), path)
38+
39+ result = bzr.get(directory=directory)
40+ self.assertEqual(result['returncode'], 0)
41+
42+ self.assertTrue(os.path.exists(path), path)
43
44 result = bzr.revision(directory=path)
45
46
47=== modified file 'utah/client/tests/test_vcs_git.py'
48--- utah/client/tests/test_vcs_git.py 2012-10-09 15:23:56 +0000
49+++ utah/client/tests/test_vcs_git.py 2012-10-10 21:42:22 +0000
50@@ -6,6 +6,7 @@
51
52 GIT_TEST_REPO = "/tmp/utahgittest"
53
54+
55 def setUp():
56 """
57 Create a local git repository to test on.
58@@ -19,6 +20,7 @@
59 run_cmd("git add test.py", cwd=GIT_TEST_REPO)
60 run_cmd("git commit -m'Initial import' test.py", cwd=GIT_TEST_REPO)
61
62+
63 def tearDown():
64 """
65 Remove the test repo.
66@@ -27,6 +29,7 @@
67 # We should only ever get here if the repo was created in setUp().
68 shutil.rmtree(GIT_TEST_REPO)
69
70+
71 class TestGitHandler(unittest.TestCase):
72 """
73 Test the bazaar VCS handler.
74@@ -52,11 +55,12 @@
75 directory = "/tmp"
76 path = os.path.join(directory, dest)
77
78- self.assertFalse(os.path.exists(path))
79-
80- git.get(directory=directory)
81-
82- self.assertTrue(os.path.exists(path))
83+ self.assertFalse(os.path.exists(path), path)
84+
85+ result = git.get(directory=directory)
86+ self.assertEqual(result['returncode'], 0)
87+
88+ self.assertTrue(os.path.exists(path), path)
89 shutil.rmtree(path)
90
91 def test_git_revision(self):
92@@ -67,7 +71,8 @@
93 path = os.path.join(directory, dest)
94
95 self.assertFalse(os.path.exists(path))
96- git.get(directory=directory)
97+ result = git.get(directory=directory)
98+ self.assertEqual(result['returncode'], 0)
99 self.assertTrue(os.path.exists(path))
100
101 result = git.revision(directory=path)

Subscribers

People subscribed via source and target branches