Commit 361d5a61 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Merge tag 'upstream/1.4.34'

Upstream version 1.4.34

# gpg: Signature made 2017-06-12T22:27:01 CEST
# gpg:                using RSA key F78CBA07817BB149A11D339069F2FC516EA71993
# gpg:                issuer "sramacher@debian.org"
# gpg: Good signature from "Sebastian Ramacher <sebastian@ramacher.at>" [ultimate]
# gpg:                 aka "Sebastian Ramacher <s.ramacher@gmail.com>" [ultimate]
# gpg:                 aka "Sebastian Ramacher <s.ramacher@gmx.at>" [ultimate]
# gpg:                 aka "Sebastian Ramacher <s.ramacher@student.tugraz.at>" [ultimate]
# gpg:                 aka "Sebastian Ramacher <sramacher@debian.org>" [ultimate]
# gpg:                 aka "Sebastian Ramacher <sebastian.ramacher@iaik.tugraz.at>" [ultimate]
parents 54413e74 a3c98e8c
1.4.34
====================================================================
- fix issue119 / pytest issue708 where tmpdir may fail to make numbered directories
when the filesystem is case-insensitive.
1.4.33
====================================================================
......
Metadata-Version: 1.1
Name: py
Version: 1.4.33
Version: 1.4.34
Summary: library with cross-python path, ini-parsing, io, code, log facilities
Home-page: http://py.readthedocs.io/
Author: holger krekel, Ronny Pfannschmidt, Benjamin Peterson and others
......
Metadata-Version: 1.1
Name: py
Version: 1.4.33
Version: 1.4.34
Summary: library with cross-python path, ini-parsing, io, code, log facilities
Home-page: http://py.readthedocs.io/
Author: holger krekel, Ronny Pfannschmidt, Benjamin Peterson and others
......
......@@ -8,7 +8,7 @@ dictionary or an import path.
(c) Holger Krekel and others, 2004-2014
"""
__version__ = '1.4.33'
__version__ = '1.4.34'
from py import _apipkg
......
......@@ -419,7 +419,7 @@ class ExceptionInfo(object):
def __unicode__(self):
entry = self.traceback[-1]
loc = ReprFileLocation(entry.path, entry.lineno + 1, self.exconly())
return unicode(loc)
return loc.__unicode__()
class FormattedExcinfo(object):
......
......@@ -170,11 +170,16 @@ class PathBase(object):
def readlines(self, cr=1):
""" read and return a list of lines from the path. if cr is False, the
newline will be removed from the end of each line. """
if sys.version_info < (3, ):
mode = 'rU'
else: # python 3 deprecates mode "U" in favor of "newline" option
mode = 'r'
if not cr:
content = self.read('rU')
content = self.read(mode)
return content.split('\n')
else:
f = self.open('rU')
f = self.open(mode)
try:
return f.readlines()
finally:
......
......@@ -10,7 +10,7 @@ from py._path import common
from py._path.common import iswin32, fspath
from stat import S_ISLNK, S_ISDIR, S_ISREG
from os.path import abspath, normpath, isabs, exists, isdir, isfile, islink, dirname
from os.path import abspath, normcase, normpath, isabs, exists, isdir, isfile, islink, dirname
if sys.version_info > (3,0):
def map_as_list(func, iter):
......@@ -205,14 +205,14 @@ class LocalPath(FSBase):
if rec:
# force remove of readonly files on windows
if iswin32:
self.chmod(448, rec=1) # octcal 0700
self.chmod(0o700, rec=1)
py.error.checked_call(py.std.shutil.rmtree, self.strpath,
ignore_errors=ignore_errors)
else:
py.error.checked_call(os.rmdir, self.strpath)
else:
if iswin32:
self.chmod(448) # octcal 0700
self.chmod(0o700)
py.error.checked_call(os.remove, self.strpath)
def computehash(self, hashtype="md5", chunksize=524288):
......@@ -801,12 +801,13 @@ class LocalPath(FSBase):
if rootdir is None:
rootdir = cls.get_temproot()
nprefix = normcase(prefix)
def parse_num(path):
""" parse the number out of a path (if it matches the prefix) """
bn = path.basename
if bn.startswith(prefix):
nbasename = normcase(path.basename)
if nbasename.startswith(nprefix):
try:
return int(bn[len(prefix):])
return int(nbasename[len(nprefix):])
except ValueError:
pass
......@@ -898,6 +899,7 @@ class LocalPath(FSBase):
return udir
make_numbered_dir = classmethod(make_numbered_dir)
def copymode(src, dest):
""" copy permission from src to dst. """
py.std.shutil.copymode(src, dest)
......
......@@ -8,7 +8,7 @@ license_file = LICENSE
formats = sdist.tgz,bdist_wheel
[egg_info]
tag_build =
tag_date = 0
tag_build =
tag_svn_revision = 0
......@@ -399,6 +399,22 @@ class TestExecution:
if i>=3:
assert not numdir.new(ext=str(i-3)).check()
def test_make_numbered_dir_case_insensitive(self, tmpdir, monkeypatch):
# https://github.com/pytest-dev/pytest/issues/708
monkeypatch.setattr(py._path.local, 'normcase', lambda path: path.lower())
monkeypatch.setattr(tmpdir, 'listdir', lambda: [tmpdir._fastjoin('case.0')])
numdir = local.make_numbered_dir(prefix='CAse.', rootdir=tmpdir,
keep=2, lock_timeout=0)
assert numdir.basename.endswith('.1')
def test_make_numbered_dir_case_sensitive(self, tmpdir, monkeypatch):
# https://github.com/pytest-dev/pytest/issues/708
monkeypatch.setattr(py._path.local, 'normcase', lambda path: path)
monkeypatch.setattr(tmpdir, 'listdir', lambda: [tmpdir._fastjoin('case.0')])
numdir = local.make_numbered_dir(prefix='CAse.', rootdir=tmpdir,
keep=2, lock_timeout=0)
assert numdir.basename.endswith('.0')
def test_make_numbered_dir_NotImplemented_Error(self, tmpdir, monkeypatch):
def notimpl(x, y):
raise NotImplementedError(42)
......
[tox]
envlist=py26,py27,py33,py34,py35
envlist=py26,py27,py33,py34,py35,py36
[testenv]
changedir=testing
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment