commit
c10f0c2c36
|
@ -13,6 +13,7 @@ syntax:glob
|
||||||
*.html
|
*.html
|
||||||
*.class
|
*.class
|
||||||
*.orig
|
*.orig
|
||||||
|
*~
|
||||||
|
|
||||||
build/
|
build/
|
||||||
dist/
|
dist/
|
||||||
|
|
|
@ -184,7 +184,7 @@ newline will be removed from the end of each line. """
|
||||||
#assert strrelpath[-1] == self.sep
|
#assert strrelpath[-1] == self.sep
|
||||||
#assert strrelpath[-2] != self.sep
|
#assert strrelpath[-2] != self.sep
|
||||||
strself = str(self)
|
strself = str(self)
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32" or getattr(os, '_name', None) == 'nt':
|
||||||
if os.path.normcase(strself).startswith(
|
if os.path.normcase(strself).startswith(
|
||||||
os.path.normcase(strrelpath)):
|
os.path.normcase(strrelpath)):
|
||||||
return strself[len(strrelpath):]
|
return strself[len(strrelpath):]
|
||||||
|
|
|
@ -315,8 +315,8 @@ class TmpTestdir:
|
||||||
else:
|
else:
|
||||||
cmdlinename = scriptname.replace(".", "")
|
cmdlinename = scriptname.replace(".", "")
|
||||||
assert hasattr(py.cmdline, cmdlinename), cmdlinename
|
assert hasattr(py.cmdline, cmdlinename), cmdlinename
|
||||||
source = ("import sys ; sys.path.insert(0, %r); "
|
source = ("import sys;sys.path.insert(0,%r);"
|
||||||
"import py ; py.cmdline.%s()" %
|
"import py;py.cmdline.%s()" %
|
||||||
(str(py._pydir.dirpath()), cmdlinename))
|
(str(py._pydir.dirpath()), cmdlinename))
|
||||||
return (sys.executable, "-c", source,)
|
return (sys.executable, "-c", source,)
|
||||||
|
|
||||||
|
@ -328,7 +328,7 @@ class TmpTestdir:
|
||||||
|
|
||||||
def _getsysprepend(self):
|
def _getsysprepend(self):
|
||||||
if not self.request.config.getvalue("toolsonpath"):
|
if not self.request.config.getvalue("toolsonpath"):
|
||||||
s = "import sys ; sys.path.insert(0, %r) ; " % str(py._pydir.dirpath())
|
s = "import sys;sys.path.insert(0,%r);" % str(py._pydir.dirpath())
|
||||||
else:
|
else:
|
||||||
s = ""
|
s = ""
|
||||||
return s
|
return s
|
||||||
|
|
|
@ -196,7 +196,7 @@ def evalexpression(item, keyword):
|
||||||
expr, result = None, True
|
expr, result = None, True
|
||||||
for expr in markholder.args:
|
for expr in markholder.args:
|
||||||
if isinstance(expr, str):
|
if isinstance(expr, str):
|
||||||
result = eval(expr, d)
|
result = cached_eval(item.config, expr, d)
|
||||||
else:
|
else:
|
||||||
result = expr
|
result = expr
|
||||||
if not result:
|
if not result:
|
||||||
|
@ -204,6 +204,18 @@ def evalexpression(item, keyword):
|
||||||
return expr, result
|
return expr, result
|
||||||
return None, False
|
return None, False
|
||||||
|
|
||||||
|
def cached_eval(config, expr, d):
|
||||||
|
if not hasattr(config, '_evalcache'):
|
||||||
|
config._evalcache = {}
|
||||||
|
try:
|
||||||
|
return config._evalcache[expr]
|
||||||
|
except KeyError:
|
||||||
|
#import sys
|
||||||
|
#print >>sys.stderr, ("cache-miss: %r" % expr)
|
||||||
|
config._evalcache[expr] = x = eval(expr, d)
|
||||||
|
return x
|
||||||
|
|
||||||
|
|
||||||
def folded_skips(skipped):
|
def folded_skips(skipped):
|
||||||
d = {}
|
d = {}
|
||||||
for event in skipped:
|
for event in skipped:
|
||||||
|
|
|
@ -85,7 +85,7 @@ class TestGeneralUsage:
|
||||||
assert result.ret == 0
|
assert result.ret == 0
|
||||||
|
|
||||||
def test_pydoc(self, testdir):
|
def test_pydoc(self, testdir):
|
||||||
result = testdir.runpython_c("import py ; help(py.test)")
|
result = testdir.runpython_c("import py;help(py.test)")
|
||||||
assert result.ret == 0
|
assert result.ret == 0
|
||||||
s = result.stdout.str()
|
s = result.stdout.str()
|
||||||
assert 'MarkGenerator' in s
|
assert 'MarkGenerator' in s
|
||||||
|
|
|
@ -4,9 +4,11 @@ from py.path import local
|
||||||
from testing.path import common
|
from testing.path import common
|
||||||
|
|
||||||
failsonjython = py.test.mark.xfail("sys.platform.startswith('java')")
|
failsonjython = py.test.mark.xfail("sys.platform.startswith('java')")
|
||||||
|
failsonjywin32 = py.test.mark.xfail("sys.platform.startswith('java') "
|
||||||
|
"and getattr(os, '_name', None) == 'nt'")
|
||||||
win32only = py.test.mark.skipif(
|
win32only = py.test.mark.skipif(
|
||||||
"not (sys.platform == 'win32' or getattr(os, '_name', None) == 'nt')")
|
"not (sys.platform == 'win32' or getattr(os, '_name', None) == 'nt')")
|
||||||
failsonwin32 = py.test.mark.skipif(
|
skiponwin32 = py.test.mark.skipif(
|
||||||
"sys.platform == 'win32' or getattr(os, '_name', None) == 'nt'")
|
"sys.platform == 'win32' or getattr(os, '_name', None) == 'nt'")
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,6 +92,7 @@ class TestLocalPath(common.CommonFSTests):
|
||||||
finally:
|
finally:
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
@failsonjywin32
|
||||||
def test_setmtime(self):
|
def test_setmtime(self):
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
|
@ -206,7 +209,7 @@ class TestExecutionOnWindows:
|
||||||
assert py.path.local.sysfind('jaksdkasldqwe') is None
|
assert py.path.local.sysfind('jaksdkasldqwe') is None
|
||||||
|
|
||||||
class TestExecution:
|
class TestExecution:
|
||||||
pytestmark = failsonwin32
|
pytestmark = skiponwin32
|
||||||
|
|
||||||
def test_sysfind(self):
|
def test_sysfind(self):
|
||||||
x = py.path.local.sysfind('test')
|
x = py.path.local.sysfind('test')
|
||||||
|
@ -411,7 +414,7 @@ class TestWINLocalPath:
|
||||||
old.chdir()
|
old.chdir()
|
||||||
|
|
||||||
class TestPOSIXLocalPath:
|
class TestPOSIXLocalPath:
|
||||||
pytestmark = failsonwin32
|
pytestmark = skiponwin32
|
||||||
|
|
||||||
def test_hardlink(self, tmpdir):
|
def test_hardlink(self, tmpdir):
|
||||||
linkpath = tmpdir.join('test')
|
linkpath = tmpdir.join('test')
|
||||||
|
|
Loading…
Reference in New Issue