Ejemplo n.º 1
0
        self.mox.ReplayAll()

        file_util.RmDirs('path/to/directory')
        self.mox.VerifyAll()

    def testRmDirsForPermissionDeniedOnParentDirectory(self):
        self.mox.StubOutWithMock(os, 'rmdir')
        os.rmdir('path/to').AndRaise(
            OSError(errno.EACCES, 'Permission denied', 'path/to'))

        self.mox.StubOutWithMock(shutil, 'rmtree')
        shutil.rmtree('path/to/directory')

        self.mox.ReplayAll()

        file_util.RmDirs('path/to/directory')
        self.mox.VerifyAll()

    def testRmDirsWithSimplePath(self):
        self.mox.StubOutWithMock(shutil, 'rmtree')
        shutil.rmtree('directory')

        self.mox.ReplayAll()

        file_util.RmDirs('directory')
        self.mox.VerifyAll()


if __name__ == '__main__':
    basetest.main()
Ejemplo n.º 2
0
def main(*args, **kwargs):
  """Call the unit test framework."""
  basetest.main(*args, **kwargs)
Ejemplo n.º 3
0
FLAGS = gflags.FLAGS


class ShellScriptTests(basetest.TestCase):
  """TestCase that runs the various *test.sh scripts."""

  def RunTestScript(self, script_name):
    tests_path = os.path.dirname(__file__)
    sh_test_path = os.path.realpath(os.path.join(tests_path, script_name))

    env = {
        # Setuptools puts dependency eggs in our path, so propagate that.
        'PYTHONPATH': os.pathsep.join(sys.path),
        'TEST_TMPDIR': FLAGS.test_tmpdir,
        }
    p = subprocess.Popen(sh_test_path, cwd=tests_path, env=env)
    self.assertEqual(0, p.wait())

  def testBaseTest(self):
    self.RunTestScript('basetest_sh_test.sh')

  def testApp(self):
    self.RunTestScript('app_unittest.sh')

  def testAppCommands(self):
    self.RunTestScript('appcommands_unittest.sh')


if __name__ == '__main__':
  basetest.main()
Ejemplo n.º 4
0
def main(*args, **kwargs):
    """Call the unit test framework."""
    basetest.main(*args, **kwargs)