From 3049c6bd2aaab71341b98d949dc5457e3dcf9428 Mon Sep 17 00:00:00 2001 From: hpk Date: Wed, 7 Feb 2007 21:40:37 +0100 Subject: [PATCH] [svn r38116] fixing svn tests for -d runs (which usually is a dependency problem) --HG-- branch : trunk --- py/path/svn/testing/svntestbase.py | 15 +++++---------- py/path/svn/testing/test_urlcommand.py | 22 ++++++++++++++++++++-- py/path/svn/testing/test_wccommand.py | 12 ++++++++++++ py/path/testing/common.py | 2 +- 4 files changed, 38 insertions(+), 13 deletions(-) diff --git a/py/path/svn/testing/svntestbase.py b/py/path/svn/testing/svntestbase.py index d36ff4ceb..caf9198ec 100644 --- a/py/path/svn/testing/svntestbase.py +++ b/py/path/svn/testing/svntestbase.py @@ -10,21 +10,16 @@ repodump = mypath.dirpath('repotest.dump') # make a wc directory out of a given root url # cache previously obtained wcs! # -def getrepowc(reponame='a~bc$aaa~', wcname='wc'): +def getrepowc(reponame='basetestrepo', wcname='wc'): repo = py.test.ensuretemp(reponame) wcdir = py.test.ensuretemp(wcname) if not repo.listdir(): #assert not wcdir.check() repo.ensure(dir=1) - try: - py.process.cmdexec('svnadmin create "%s"' % - svncommon._escape_helper(repo)) - py.process.cmdexec('svnadmin load -q "%s" <"%s"' % - (svncommon._escape_helper(repo), repodump)) - except py.process.cmdexec.Error: - raise - repo.remove() - raise py.test.skip('could not create temporary svn test repository') + py.process.cmdexec('svnadmin create "%s"' % + svncommon._escape_helper(repo)) + py.process.cmdexec('svnadmin load -q "%s" <"%s"' % + (svncommon._escape_helper(repo), repodump)) print "created svn repository", repo wcdir.ensure(dir=1) wc = py.path.svnwc(wcdir) diff --git a/py/path/svn/testing/test_urlcommand.py b/py/path/svn/testing/test_urlcommand.py index 375b0b9d6..457332eef 100644 --- a/py/path/svn/testing/test_urlcommand.py +++ b/py/path/svn/testing/test_urlcommand.py @@ -9,11 +9,27 @@ def setup_module(mod): if py.path.local.sysfind('svn') is None: py.test.skip("cannot test py.path.svn, 'svn' binary not found") -class TestSvnCommandPath(CommonCommandAndBindingTests): +class TestSvnURLCommandPath(CommonCommandAndBindingTests): def setup_class(cls): repo, wc = getrepowc() cls.root = py.path.svnurl(repo) + def test_move_file(self): # overrides base class + p = self.root.ensure('origfile') + newp = p.dirpath('newfile') + p.move(newp) + assert newp.check(file=1) + newp.remove() + assert not p.check() + + def test_move_dir(self): # overrides base class + p = self.root.ensure('origdir', dir=1) + newp = p.dirpath('newdir') + p.move(newp) + assert newp.check(dir=1) + newp.remove() + assert not p.check() + def test_svnurl_needs_arg(self): py.test.raises(TypeError, "py.path.svnurl()") @@ -52,7 +68,9 @@ class TestSvnInfoCommand: assert info.last_author == 'hpk' assert info.created_rev == 2256 assert info.kind == 'file' - assert time.gmtime(info.mtime)[:6] == (2006, 11, 24, 17, 55, 0) + # we don't check for the year (2006), because that depends + # on the clock correctly being setup + assert time.gmtime(info.mtime)[1:6] == (11, 24, 17, 55, 0) assert info.size == 165 assert info.time == info.mtime * 1000000 diff --git a/py/path/svn/testing/test_wccommand.py b/py/path/svn/testing/test_wccommand.py index cb853e5e0..6a92ce3b0 100644 --- a/py/path/svn/testing/test_wccommand.py +++ b/py/path/svn/testing/test_wccommand.py @@ -14,6 +14,18 @@ class TestWCSvnCommandPath(CommonSvnTests): def setup_class(cls): repo, cls.root = getrepowc() + def test_move_file(self): # overrides base class + try: + super(TestWCSvnCommandPath, self).test_move_file() + finally: + self.root.revert(rec=1) + + def test_move_directory(self): # overrides base class + try: + super(TestWCSvnCommandPath, self).test_move_directory() + finally: + self.root.revert(rec=1) + def test_status_attributes_simple(self): def assert_nochange(p): s = p.status() diff --git a/py/path/testing/common.py b/py/path/testing/common.py index 8e16aa5d5..f8bc26cc4 100644 --- a/py/path/testing/common.py +++ b/py/path/testing/common.py @@ -1,7 +1,7 @@ from py.__.path.common import checker import py -class CommonPathTests: +class CommonPathTests(object): root = None # subclasses have to setup a 'root' attribute def test_constructor_equality(self):