def setUp(self): self.repository_path = os.path.join(example_repositories, "subversion") self.repos = SubversionRepository("file://%s" % self.repository_path) self.tmpdir = tempfile.mkdtemp() self.repos.checkout(self.tmpdir) self.wc = SubversionWorkingCopy(self.tmpdir) self.latest_version = "3" self.previous_version = "1"
class TestSubversionWorkingCopy(unittest.TestCase, BaseTestWorkingCopy): def setUp(self): self.repository_path = os.path.join(example_repositories, "subversion") self.repos = SubversionRepository("file://%s" % self.repository_path) self.tmpdir = tempfile.mkdtemp() self.repos.checkout(self.tmpdir) self.wc = SubversionWorkingCopy(self.tmpdir) self.latest_version = "3" self.previous_version = "1" def tearDown(self): shutil.rmtree(self.tmpdir) #def test__status(self): # self.assertEqual(self.wc.status()['modified'], []) # self.change_file() # self.assertEqual(os.path.basename(self.wc.status()['modified'][0]), 'romans.param') def test__status(self): self.assertEqual( self.wc.status(), { 'modified': set([]), 'removed': set([]), 'missing': set([]), 'unknown': set([]), 'added': set([]), 'clean': set([ 'EGG-INFO', 'subpackage', 'EGG-INFO/PKG-INFO', 'default.param', 'main.py', 'romans.param', 'subpackage/__init__.py', 'subpackage/somemodule.py' ]) }) self.change_file() self.assertEqual( self.wc.status(), { 'modified': set(['romans.param']), 'removed': set([]), 'missing': set([]), 'unknown': set([]), 'added': set([]), 'clean': set([ 'EGG-INFO', 'subpackage', 'EGG-INFO/PKG-INFO', 'default.param', 'main.py', 'subpackage/__init__.py', 'subpackage/somemodule.py' ]) })
def test__get_repository_from_working_copy(self): repos = SubversionRepository("file://%s/subversion" % self.basepath) tmpdir = tempfile.mkdtemp() repos.checkout(tmpdir) orig_dir = os.getcwd() os.chdir(tmpdir) repos1 = get_repository(None) os.chdir(orig_dir) self.assertEqual(repos, repos1) shutil.rmtree(tmpdir)
class TestSubversionWorkingCopy(unittest.TestCase, BaseTestWorkingCopy): def setUp(self): self.repository_path = os.path.join(example_repositories, "subversion") self.repos = SubversionRepository("file://%s" % self.repository_path) self.tmpdir = tempfile.mkdtemp() self.repos.checkout(self.tmpdir) self.wc = SubversionWorkingCopy(self.tmpdir) self.latest_version = "3" self.previous_version = "1" def tearDown(self): shutil.rmtree(self.tmpdir) #def test__status(self): # self.assertEqual(self.wc.status()['modified'], []) # self.change_file() # self.assertEqual(os.path.basename(self.wc.status()['modified'][0]), 'romans.param') def test__status(self): self.assertEqual(self.wc.status(), {'modified': set([]), 'removed': set([]), 'missing': set([]), 'unknown': set([]), 'added': set([]), 'clean': set(['EGG-INFO', 'subpackage', 'EGG-INFO/PKG-INFO', 'default.param', 'main.py', 'romans.param', 'subpackage/__init__.py', 'subpackage/somemodule.py'])}) self.change_file() self.assertEqual(self.wc.status(), {'modified': set(['romans.param']), 'removed': set([]), 'missing': set([]), 'unknown': set([]), 'added': set([]), 'clean': set(['EGG-INFO', 'subpackage', 'EGG-INFO/PKG-INFO', 'default.param', 'main.py', 'subpackage/__init__.py', 'subpackage/somemodule.py'])})
def test__exists__with_nonexistent_repos__should_raise_Exception(self): r = SubversionRepository("file:///tmp/chnseriguchs") self.assertFalse(r.exists)
def _create_repository(self): return SubversionRepository("file://%s" % self.repository_path)