fixing windows32 svn-testing issues

--HG--
branch : trunk
This commit is contained in:
holger krekel 2009-12-25 01:47:43 -08:00
parent 516cee2a94
commit abb05d9384
3 changed files with 17 additions and 21 deletions

View File

@ -11,7 +11,7 @@ def pytest_funcarg__repowc1(request):
modname = request.module.__name__
tmpdir = request.getfuncargvalue("tmpdir")
repo, wc = request.cached_setup(
repo, repourl, wc = request.cached_setup(
setup=lambda: getrepowc(tmpdir, "repo-"+modname, "wc-" + modname),
scope="module",
)
@ -19,12 +19,13 @@ def pytest_funcarg__repowc1(request):
if request.function.__name__.startswith(x):
_savedrepowc = save_repowc(repo, wc)
request.addfinalizer(lambda: restore_repowc(_savedrepowc))
return repo, wc
return repo, repourl, wc
def pytest_funcarg__repowc2(request):
tmpdir = request.getfuncargvalue("tmpdir")
name = request.function.__name__
return getrepowc(tmpdir, "%s-repo-2" % name, "%s-wc-2" % name)
repo, url, wc = getrepowc(tmpdir, "%s-repo-2" % name, "%s-wc-2" % name)
return repo, url, wc
def getsvnbin():
if svnbin is None:
@ -46,14 +47,16 @@ def getrepowc(tmpdir, reponame='basetestrepo', wcname='wc'):
wcdir.ensure(dir=1)
wc = py.path.svnwc(wcdir)
if py.std.sys.platform == 'win32':
repo = '/' + str(repo).replace('\\', '/')
wc.checkout(url='file://%s' % repo)
repourl = "file://" + '/' + str(repo).replace('\\', '/')
else:
repourl = "file://%s" % repo
wc.checkout(repourl)
print_("checked out new repo into", wc)
return ("file://%s" % repo, wc)
return (repo, repourl, wc)
def save_repowc(repo, wc):
repo = py.path.local(repo[len("file://"):])
assert not str(repo).startswith("file://"), repo
assert repo.check()
savedrepo = repo.dirpath(repo.basename+".1")
savedwc = wc.dirpath(wc.basename+".1")

View File

@ -5,8 +5,8 @@ import time
from testing.path.svntestbase import CommonSvnTests
def pytest_funcarg__path1(request):
repo, wc = request.getfuncargvalue("repowc1")
return py.path.svnurl(repo)
repo, repourl, wc = request.getfuncargvalue("repowc1")
return py.path.svnurl(repourl)
class TestSvnURLCommandPath(CommonSvnTests):
@py.test.mark.xfail

View File

@ -1,17 +1,9 @@
import py
import sys
import os, sys
from py.impl.path.svnwc import InfoSvnWCCommand, XMLWCStatus, parse_wcinfotime
from py.impl.path import svnwc as svncommon
from testing.path.svntestbase import CommonSvnTests
if sys.platform == 'win32':
def normpath(p):
return p
else:
def normpath(p):
p = py.test.importorskip("win32").GetShortPathName(p)
return os.path.normpath(os.path.normcase(p))
def test_make_repo(path1, tmpdir):
repo = tmpdir.join("repo")
py.process.cmdexec('svnadmin create %s' % repo)
@ -32,7 +24,7 @@ def test_make_repo(path1, tmpdir):
assert rev is None
def pytest_funcarg__path1(request):
repo, wc = request.getfuncargvalue("repowc1")
repo, repourl, wc = request.getfuncargvalue("repowc1")
return wc
class TestWCSvnCommandPath(CommonSvnTests):
@ -181,7 +173,7 @@ class TestWCSvnCommandPath(CommonSvnTests):
assert [x.basename for x in s.conflict] == ['conflictsamplefile']
def test_status_external(self, path1, repowc2):
otherrepo, otherwc = repowc2
otherrepo, otherrepourl, otherwc = repowc2
d = path1.ensure('sampledir', dir=1)
try:
d.remove()
@ -366,7 +358,8 @@ class TestWCSvnCommandPath(CommonSvnTests):
try:
locked = root.status().locked
assert len(locked) == 1
assert normpath(str(locked[0])) == normpath(str(somefile))
assert locked[0].basename == somefile.basename
assert locked[0].dirpath().basename == somefile.dirpath().basename
#assert somefile.locked()
py.test.raises(Exception, 'somefile.lock()')
finally: