Two changes to ease CI:
1) If pysvn is missing, the tests for svn_helper don't run and pollute the
output
2) svn_helper no longer depends on being located at trunk/scripts/
Patch by: Augie Fackler
Review by: Todd Larsen
Review Issue: 802
Reviewed URL: http://codereviews.googleopensourceprograms.com/802
--- a/scripts/svn_helper.py Sat Sep 20 19:04:43 2008 +0000
+++ b/scripts/svn_helper.py Sun Sep 21 02:16:00 2008 +0000
@@ -36,7 +36,8 @@
import os
import pysvn
-from trunk.scripts import settings
+# top level script needs to use a relative import
+import settings
#: all of the directory entry node_kinds supported py pysvn
--- a/tests/svn_helper_test.py Sat Sep 20 19:04:43 2008 +0000
+++ b/tests/svn_helper_test.py Sun Sep 21 02:16:00 2008 +0000
@@ -29,49 +29,53 @@
import os
-import pysvn
+try:
+ import pysvn
+except:
+ pysvn = None
import sys
import unittest
-from ..scripts import svn_helper
+if pysvn is not None:
+ from ..scripts import svn_helper
-class SvnHelperTests(unittest.TestCase):
- """pysvn wrapper tests for the svn_helper.py module.
- """
+ class SvnHelperTests(unittest.TestCase):
+ """pysvn wrapper tests for the svn_helper.py module.
+ """
- def setUp(self):
- self.client = pysvn.Client()
+ def setUp(self):
+ self.client = pysvn.Client()
- def testLsFiles(self):
- """Test if lsFiles() contains only file entries, using the SoC SVN repo.
- """
- self.assert_(
- 'svn_helper_test.py' in svn_helper.lsFiles(
- 'http://soc.googlecode.com/svn/trunk/tests', client=self.client))
+ def testLsFiles(self):
+ """Test if lsFiles() contains only file entries, using the SoC SVN repo.
+ """
+ self.assert_(
+ 'svn_helper_test.py' in svn_helper.lsFiles(
+ 'http://soc.googlecode.com/svn/trunk/tests', client=self.client))
- self.assert_(
- 'tests/' not in svn_helper.lsFiles(
- 'http://soc.googlecode.com/svn/trunk', client=self.client))
+ self.assert_(
+ 'tests/' not in svn_helper.lsFiles(
+ 'http://soc.googlecode.com/svn/trunk', client=self.client))
- def testLsDirs(self):
- """Test if lsDirs() contains only dir entries, using the SoC SVN repo.
- """
- self.assert_(
- 'tests/' in svn_helper.lsDirs(
- 'http://soc.googlecode.com/svn/trunk', client=self.client))
+ def testLsDirs(self):
+ """Test if lsDirs() contains only dir entries, using the SoC SVN repo.
+ """
+ self.assert_(
+ 'tests/' in svn_helper.lsDirs(
+ 'http://soc.googlecode.com/svn/trunk', client=self.client))
- self.assert_(
- 'svn_helper_test.py' not in svn_helper.lsDirs(
- 'http://soc.googlecode.com/svn/trunk/tests', client=self.client))
+ self.assert_(
+ 'svn_helper_test.py' not in svn_helper.lsDirs(
+ 'http://soc.googlecode.com/svn/trunk/tests', client=self.client))
- def testExists(self):
- """Test if exists() works on the the SoC SVN repo.
- """
- self.assertEqual(
- True, svn_helper.exists(
- 'http://soc.googlecode.com/svn/trunk', client=self.client))
+ def testExists(self):
+ """Test if exists() works on the the SoC SVN repo.
+ """
+ self.assertEqual(
+ True, svn_helper.exists(
+ 'http://soc.googlecode.com/svn/trunk', client=self.client))
- self.assertEqual(
- False, svn_helper.exists(
- 'http://soc.googlecode.com/svn/does_not_exist', client=self.client))
+ self.assertEqual(
+ False, svn_helper.exists(
+ 'http://soc.googlecode.com/svn/does_not_exist', client=self.client))