From 621f925985feeaf27473182c81d7ca0206b49394 Mon Sep 17 00:00:00 2001 From: hpk Date: Fri, 5 Sep 2008 11:02:58 +0200 Subject: [PATCH] [svn r57831] small test cleanups while prepping for pycon uk slides --HG-- branch : trunk --- py/path/local/testing/test_local.py | 11 ----------- py/path/local/testing/test_posix.py | 20 ++++++++++---------- py/path/svn/testing/test_wccommand.py | 8 ++++---- 3 files changed, 14 insertions(+), 25 deletions(-) diff --git a/py/path/local/testing/test_local.py b/py/path/local/testing/test_local.py index 9aeb09492..e86e4d3e6 100644 --- a/py/path/local/testing/test_local.py +++ b/py/path/local/testing/test_local.py @@ -1,7 +1,6 @@ import py import sys from py.path import local -from py.__.path.common import checker from py.__.path.testing.fscommon import CommonFSTests, setuptestfs class LocalSetup: @@ -343,7 +342,6 @@ class TestExecution(LocalSetup): def test_pypkgdir(): datadir = py.test.ensuretemp("pypkgdir") - pkg = datadir.ensure('pkg1', dir=1) pkg.ensure("__init__.py") pkg.ensure("subdir/__init__.py") @@ -354,12 +352,3 @@ def test_homedir(): homedir = py.path.local._gethomedir() assert homedir.check(dir=1) -#class XTestLocalPath(TestLocalPath): -# def __init__(self): -# TestLocalPath.__init__(self) -# self.root = local(self.root) -# -#class XXTestLocalPath(TestLocalPath): -# def __init__(self): -# TestLocalPath.__init__(self) -# self.root = local(self.root) diff --git a/py/path/local/testing/test_posix.py b/py/path/local/testing/test_posix.py index cab903a1a..ee2fe4129 100644 --- a/py/path/local/testing/test_posix.py +++ b/py/path/local/testing/test_posix.py @@ -1,7 +1,6 @@ import py class TestPOSIXLocalPath: - #root = local(TestLocalPath.root) disabled = py.std.sys.platform == 'win32' def setup_class(cls): @@ -103,16 +102,17 @@ class TestPOSIXLocalPath: assert gid == stat.gid assert group == stat.group - def XXXtest_atime(self): - # XXX disabled. this test is just not platform independent enough - # because acesstime resolution is very different through - # filesystems even on one platform. + def test_atime(self): import time - path = self.root.join('samplefile') - atime = path.atime() - time.sleep(1) - path.read(1) - assert path.atime() != atime + path = self.root.ensure('samplefile') + now = time.time() + atime1 = path.atime() + # we could wait here but timer resolution is very + # system dependent + path.read() + atime2 = path.atime() + duration = time.time() - now + assert (atime2-atime1) <= duration def test_commondir(self): # XXX This is here in local until we find a way to implement this diff --git a/py/path/svn/testing/test_wccommand.py b/py/path/svn/testing/test_wccommand.py index 82ee187cc..1b7887412 100644 --- a/py/path/svn/testing/test_wccommand.py +++ b/py/path/svn/testing/test_wccommand.py @@ -6,9 +6,6 @@ from py.__.path.svn.wccommand import parse_wcinfotime from py.__.path.svn import svncommon from py.__.conftest import option -if py.path.local.sysfind('svn') is None: - py.test.skip("cannot test py.path.svn, 'svn' binary not found") - if sys.platform != 'win32': def normpath(p): return p @@ -24,8 +21,11 @@ else: p = win32api.GetShortPathName(p) return os.path.normpath(os.path.normcase(p)) -class TestWCSvnCommandPath(CommonSvnTests): +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 TestWCSvnCommandPath(CommonSvnTests): def setup_class(cls): repo, cls.root = getrepowc()