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
=== modified file 'utah/client/tests/test_vcs_bzr.py'
--- utah/client/tests/test_vcs_bzr.py 2012-10-09 15:23:56 +0000
+++ utah/client/tests/test_vcs_bzr.py 2012-10-10 21:42:22 +0000
@@ -4,6 +4,7 @@
44
5from utah.client.common import BzrHandler5from utah.client.common import BzrHandler
66
7
7class TestBzrHandler(unittest.TestCase):8class TestBzrHandler(unittest.TestCase):
8 """9 """
9 Test the bazaar VCS handler.10 Test the bazaar VCS handler.
@@ -29,11 +30,12 @@
29 directory = "/tmp"30 directory = "/tmp"
30 path = os.path.join(directory, dest)31 path = os.path.join(directory, dest)
3132
32 self.assertFalse(os.path.exists(path))33 self.assertFalse(os.path.exists(path), path)
3334
34 bzr.get(directory=directory)35 result = bzr.get(directory=directory)
3536 self.assertEqual(result['returncode'], 0)
36 self.assertTrue(os.path.exists(path))37
38 self.assertTrue(os.path.exists(path), path)
37 shutil.rmtree(path)39 shutil.rmtree(path)
3840
39 def test_bzr_revision(self):41 def test_bzr_revision(self):
@@ -43,9 +45,12 @@
43 directory = "/tmp"45 directory = "/tmp"
44 path = os.path.join(directory, dest)46 path = os.path.join(directory, dest)
4547
46 self.assertFalse(os.path.exists(path))48 self.assertFalse(os.path.exists(path), path)
47 bzr.get(directory=directory)49
48 self.assertTrue(os.path.exists(path))50 result = bzr.get(directory=directory)
51 self.assertEqual(result['returncode'], 0)
52
53 self.assertTrue(os.path.exists(path), path)
4954
50 result = bzr.revision(directory=path)55 result = bzr.revision(directory=path)
5156
5257
=== modified file 'utah/client/tests/test_vcs_git.py'
--- utah/client/tests/test_vcs_git.py 2012-10-09 15:23:56 +0000
+++ utah/client/tests/test_vcs_git.py 2012-10-10 21:42:22 +0000
@@ -6,6 +6,7 @@
66
7GIT_TEST_REPO = "/tmp/utahgittest"7GIT_TEST_REPO = "/tmp/utahgittest"
88
9
9def setUp():10def setUp():
10 """11 """
11 Create a local git repository to test on.12 Create a local git repository to test on.
@@ -19,6 +20,7 @@
19 run_cmd("git add test.py", cwd=GIT_TEST_REPO)20 run_cmd("git add test.py", cwd=GIT_TEST_REPO)
20 run_cmd("git commit -m'Initial import' test.py", cwd=GIT_TEST_REPO)21 run_cmd("git commit -m'Initial import' test.py", cwd=GIT_TEST_REPO)
2122
23
22def tearDown():24def tearDown():
23 """25 """
24 Remove the test repo.26 Remove the test repo.
@@ -27,6 +29,7 @@
27 # We should only ever get here if the repo was created in setUp().29 # We should only ever get here if the repo was created in setUp().
28 shutil.rmtree(GIT_TEST_REPO)30 shutil.rmtree(GIT_TEST_REPO)
2931
32
30class TestGitHandler(unittest.TestCase):33class TestGitHandler(unittest.TestCase):
31 """34 """
32 Test the bazaar VCS handler.35 Test the bazaar VCS handler.
@@ -52,11 +55,12 @@
52 directory = "/tmp"55 directory = "/tmp"
53 path = os.path.join(directory, dest)56 path = os.path.join(directory, dest)
5457
55 self.assertFalse(os.path.exists(path))58 self.assertFalse(os.path.exists(path), path)
5659
57 git.get(directory=directory)60 result = git.get(directory=directory)
5861 self.assertEqual(result['returncode'], 0)
59 self.assertTrue(os.path.exists(path))62
63 self.assertTrue(os.path.exists(path), path)
60 shutil.rmtree(path)64 shutil.rmtree(path)
6165
62 def test_git_revision(self):66 def test_git_revision(self):
@@ -67,7 +71,8 @@
67 path = os.path.join(directory, dest)71 path = os.path.join(directory, dest)
6872
69 self.assertFalse(os.path.exists(path))73 self.assertFalse(os.path.exists(path))
70 git.get(directory=directory)74 result = git.get(directory=directory)
75 self.assertEqual(result['returncode'], 0)
71 self.assertTrue(os.path.exists(path))76 self.assertTrue(os.path.exists(path))
7277
73 result = git.revision(directory=path)78 result = git.revision(directory=path)

Subscribers

People subscribed via source and target branches