Hello community, here is the log from the commit of package python-py for openSUSE:Factory checked in at 2013-12-09 17:01:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-py (Old) and /work/SRC/openSUSE:Factory/.python-py.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-py" Changes: -------- --- /work/SRC/openSUSE:Factory/python-py/python-py.changes 2013-10-25 11:26:58.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-py.new/python-py.changes 2013-12-09 17:01:35.000000000 +0100 @@ -1,0 +2,24 @@ +Sun Dec 8 21:10:33 UTC 2013 - [email protected] + +- Update to version 1.4.18 + + introduce path.ensure_dir() as a synonym for ensure(..., dir=1) + + some unicode/python3 related fixes wrt to path manipulations + (if you start passing unicode particular in py2 you might + still get problems, though) +- Changes from 1.4.17 + + make py.io.TerminalWriter() prefer colorama if it is available + and avoid empty lines when separator-lines are printed by + being defensive and reducing the working terminalwidth by 1 + + introduce optional "expanduser" argument to py.path.local + to that local("~", expanduser=True) gives the home + directory of "user". +- Changes from 1.4.16 + + fix issue35 - define __gt__ ordering between a local path + and strings + + fix issue36 - make chdir() work even if os.getcwd() fails. + + add path.exists/isdir/isfile/islink shortcuts + + introduce local path.as_cwd() context manager. + + introduce p.write(ensure=1) and p.open(ensure=1) + where ensure triggers creation of neccessary parent dirs. + +------------------------------------------------------------------- Old: ---- py-1.4.15.tar.gz New: ---- py-1.4.18.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-py.spec ++++++ --- /var/tmp/diff_new_pack.aNtZ7c/_old 2013-12-09 17:01:35.000000000 +0100 +++ /var/tmp/diff_new_pack.aNtZ7c/_new 2013-12-09 17:01:35.000000000 +0100 @@ -17,7 +17,7 @@ Name: python-py -Version: 1.4.15 +Version: 1.4.18 Release: 0 Summary: Library with cross-python path, ini-parsing, io, code, log facilities License: MIT ++++++ py-1.4.15.tar.gz -> py-1.4.18.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.15/CHANGELOG new/py-1.4.18/CHANGELOG --- old/py-1.4.15/CHANGELOG 2013-06-21 16:36:31.000000000 +0200 +++ new/py-1.4.18/CHANGELOG 2013-10-29 11:34:25.000000000 +0100 @@ -1,3 +1,40 @@ +Changes between 1.4.17 and 1.4.18 +================================================== + +- introduce path.ensure_dir() as a synonym for ensure(..., dir=1) + +- some unicode/python3 related fixes wrt to path manipulations + (if you start passing unicode particular in py2 you might + still get problems, though) + +Changes between 1.4.16 and 1.4.17 +================================================== + +- make py.io.TerminalWriter() prefer colorama if it is available + and avoid empty lines when separator-lines are printed by + being defensive and reducing the working terminalwidth by 1 + +- introduce optional "expanduser" argument to py.path.local + to that local("~", expanduser=True) gives the home + directory of "user". + +Changes between 1.4.15 and 1.4.16 +================================================== + +- fix issue35 - define __gt__ ordering between a local path + and strings + +- fix issue36 - make chdir() work even if os.getcwd() fails. + +- add path.exists/isdir/isfile/islink shortcuts + +- introduce local path.as_cwd() context manager. + +- introduce p.write(ensure=1) and p.open(ensure=1) + where ensure triggers creation of neccessary parent + dirs. + + Changes between 1.4.14 and 1.4.15 ================================================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.15/PKG-INFO new/py-1.4.18/PKG-INFO --- old/py-1.4.15/PKG-INFO 2013-06-21 16:36:31.000000000 +0200 +++ new/py-1.4.18/PKG-INFO 2013-10-29 11:34:25.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: py -Version: 1.4.15 +Version: 1.4.18 Summary: library with cross-python path, ini-parsing, io, code, log facilities Home-page: http://pylib.readthedocs.org/ Author: holger krekel, Ronny Pfannschmidt, Benjamin Peterson and others diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.15/py/__init__.py new/py-1.4.18/py/__init__.py --- old/py-1.4.15/py/__init__.py 2013-06-21 16:36:31.000000000 +0200 +++ new/py-1.4.18/py/__init__.py 2013-10-29 11:34:25.000000000 +0100 @@ -8,7 +8,7 @@ (c) Holger Krekel and others, 2004-2013 """ -__version__ = '1.4.15' +__version__ = '1.4.18' from py import _apipkg diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.15/py/_code/code.py new/py-1.4.18/py/_code/code.py --- old/py-1.4.15/py/_code/code.py 2013-06-21 16:36:31.000000000 +0200 +++ new/py-1.4.18/py/_code/code.py 2013-10-29 11:34:25.000000000 +0100 @@ -1,5 +1,5 @@ import py -import sys, os.path +import sys from inspect import CO_VARARGS, CO_VARKEYWORDS builtin_repr = repr diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.15/py/_code/source.py new/py-1.4.18/py/_code/source.py --- old/py-1.4.15/py/_code/source.py 2013-06-21 16:36:31.000000000 +0200 +++ new/py-1.4.18/py/_code/source.py 2013-10-29 11:34:25.000000000 +0100 @@ -318,7 +318,7 @@ return newlines def get_statement_startend(lineno, nodelist): - from bisect import bisect_right, bisect_left + from bisect import bisect_right # lineno starts at 0 nextlineno = None while 1: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.15/py/_io/saferepr.py new/py-1.4.18/py/_io/saferepr.py --- old/py-1.4.15/py/_io/saferepr.py 2013-06-21 16:36:31.000000000 +0200 +++ new/py-1.4.18/py/_io/saferepr.py 2013-10-29 11:34:25.000000000 +0100 @@ -1,5 +1,5 @@ import py -import sys, os.path +import sys builtin_repr = repr diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.15/py/_io/terminalwriter.py new/py-1.4.18/py/_io/terminalwriter.py --- old/py-1.4.15/py/_io/terminalwriter.py 2013-06-21 16:36:31.000000000 +0200 +++ new/py-1.4.18/py/_io/terminalwriter.py 2013-10-29 11:34:25.000000000 +0100 @@ -11,12 +11,17 @@ from py.builtin import text, bytes win32_and_ctypes = False +colorama = None if sys.platform == "win32": try: - import ctypes - win32_and_ctypes = True + import colorama except ImportError: - pass + try: + import ctypes + win32_and_ctypes = True + except ImportError: + pass + def _getdimensions(): import termios,fcntl,struct @@ -117,6 +122,8 @@ elif py.builtin.callable(file) and not ( hasattr(file, "write") and hasattr(file, "flush")): file = WriteFile(file, encoding=encoding) + if hasattr(file, "isatty") and file.isatty() and colorama: + file = colorama.AnsiToWin32(file).stream self.encoding = encoding or getattr(file, 'encoding', "utf-8") self._file = file self.fullwidth = get_terminal_width() @@ -143,6 +150,12 @@ fullwidth = self.fullwidth # the goal is to have the line be as long as possible # under the condition that len(line) <= fullwidth + if sys.platform == "win32": + # if we print in the last column on windows we are on a + # new line but there is no way to verify/neutralize this + # (we may not know the exact line width) + # so let's be defensive to avoid empty lines in the output + fullwidth -= 1 if title is not None: # we want 2 + 2*len(fill) + len(title) <= fullwidth # i.e. 2 + 2*len(sepchar)*N + len(title) <= fullwidth diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.15/py/_path/common.py new/py-1.4.18/py/_path/common.py --- old/py-1.4.15/py/_path/common.py 2013-06-21 16:36:31.000000000 +0200 +++ new/py-1.4.18/py/_path/common.py 2013-10-29 11:34:25.000000000 +0100 @@ -223,6 +223,10 @@ return strself[len(strrelpath):] return "" + def ensure_dir(self, *args): + """ ensure the path joined with args is a directory. """ + return self.ensure(*args, **{"dir": True}) + def bestrelpath(self, dest): """ return a string which is a relative path from self (assumed to be a directory) to dest such that @@ -249,6 +253,14 @@ except AttributeError: return str(dest) + def exists(self): + return self.check() + + def isdir(self): + return self.check(dir=1) + + def isfile(self): + return self.check(file=1) def parts(self, reverse=False): """ return a root-first list of all ancestor directories diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.15/py/_path/local.py new/py-1.4.18/py/_path/local.py --- old/py-1.4.15/py/_path/local.py 2013-06-21 16:36:31.000000000 +0200 +++ new/py-1.4.18/py/_path/local.py 2013-10-29 11:34:25.000000000 +0100 @@ -1,12 +1,13 @@ """ local path implementation. """ -import sys, os, stat, re, atexit +from contextlib import contextmanager +import sys, os, re, atexit import py from py._path import common from stat import S_ISLNK, S_ISDIR, S_ISREG -from os.path import normpath, isabs, exists, isdir, isfile +from os.path import normpath, isabs, exists, isdir, isfile, islink iswin32 = sys.platform == "win32" or (getattr(os, '_name', False) == 'nt') @@ -133,54 +134,64 @@ st = self.path.lstat() return S_ISLNK(st.mode) - def __init__(self, path=None): + def __init__(self, path=None, expanduser=False): """ Initialize and return a local Path instance. Path can be relative to the current directory. - If it is None then the current working directory is taken. + If path is None it defaults to the current working directory. + If expanduser is True, tilde-expansion is performed. Note that Path instances always carry an absolute path. Note also that passing in a local path object will simply return the exact same path object. Use new() to get a new copy. """ if path is None: - self.strpath = os.getcwd() + self.strpath = py.error.checked_call(os.getcwd) elif isinstance(path, common.PathBase): self.strpath = path.strpath elif isinstance(path, py.builtin._basestring): + if expanduser: + path = os.path.expanduser(path) self.strpath = os.path.abspath(normpath(str(path))) else: raise ValueError("can only pass None, Path instances " "or non-empty strings to LocalPath") - assert isinstance(self.strpath, str) + assert isinstance(self.strpath, py.builtin._basestring) def __hash__(self): return hash(self.strpath) def __eq__(self, other): - s1 = str(self) - s2 = str(other) + s1 = self.strpath + s2 = getattr(other, "strpath", other) if iswin32: s1 = s1.lower() - s2 = s2.lower() + try: + s2 = s2.lower() + except AttributeError: + return False return s1 == s2 def __ne__(self, other): return not (self == other) def __lt__(self, other): - return str(self) < str(other) + return self.strpath < getattr(other, "strpath", other) + + def __gt__(self, other): + return self.strpath > getattr(other, "strpath", other) def samefile(self, other): """ return True if 'other' references the same file as 'self'. """ - if not isinstance(other, py.path.local): - other = os.path.abspath(str(other)) + other = getattr(other, "strpath", other) + if not os.path.isabs(other): + other = os.path.abspath(other) if self == other: return True if iswin32: - return False # ther is no samefile + return False # there is no samefile return py.error.checked_call( - os.path.samefile, str(self), str(other)) + os.path.samefile, self.strpath, other) def remove(self, rec=1, ignore_errors=False): """ remove a file or directory (or a directory tree if rec=1). @@ -299,7 +310,7 @@ of the args is an absolute path. """ sep = self.sep - strargs = map_as_list(str, args) + strargs = [getattr(arg, "strpath", arg) for arg in args] strpath = self.strpath if kwargs.get('abs'): newargs = [] @@ -320,8 +331,13 @@ obj.strpath = normpath(strpath) return obj - def open(self, mode='r'): - """ return an opened file with the given mode. """ + def open(self, mode='r', ensure=False): + """ return an opened file with the given mode. + + If ensure is True, create parent directories if needed. + """ + if ensure: + self.dirpath().ensure(dir=1) return py.error.checked_call(open, self.strpath, mode) def _fastjoin(self, name): @@ -329,7 +345,9 @@ child.strpath = self.strpath + self.sep + name return child - _fastcheck = set("file dir link") + def islink(self): + return islink(self.strpath) + def check(self, **kw): if not kw: return exists(self.strpath) @@ -348,7 +366,7 @@ if fil is None and sort is None: names = py.error.checked_call(os.listdir, self.strpath) return map_as_list(self._fastjoin, names) - if isinstance(fil, str): + if isinstance(fil, py.builtin._basestring): if not self._patternchars.intersection(fil): child = self._fastjoin(fil) if os.path.exists(child.strpath): @@ -400,7 +418,8 @@ def rename(self, target): """ rename this path to target. """ - return py.error.checked_call(os.rename, str(self), str(target)) + target = getattr(target, "strpath", target) + return py.error.checked_call(os.rename, self.strpath, target) def dump(self, obj, bin=1): """ pickle object into path location""" @@ -413,11 +432,15 @@ def mkdir(self, *args): """ create & return the directory joined with args. """ p = self.join(*args) - py.error.checked_call(os.mkdir, str(p)) + py.error.checked_call(os.mkdir, getattr(p, "strpath", p)) return p - def write(self, data, mode='w'): - """ write data into path. """ + def write(self, data, mode='w', ensure=False): + """ write data into path. If ensure is True create + missing parent directories. + """ + if ensure: + self.dirpath().ensure(dir=1) if 'b' in mode: if not py.builtin._isbytes(data): raise ValueError("can only process bytes") @@ -493,10 +516,25 @@ def chdir(self): """ change directory to self and return old current directory """ - old = self.__class__() + try: + old = self.__class__() + except py.error.ENOENT: + old = None py.error.checked_call(os.chdir, self.strpath) return old + + @contextmanager + def as_cwd(self): + """ return context manager which changes to current dir during the + managed "with" context. On __enter__ it returns the old dir. + """ + old = self.chdir() + try: + yield old + finally: + old.chdir() + def realpath(self): """ return a new path which contains no symbolic links.""" return self.__class__(os.path.realpath(self.strpath)) @@ -685,7 +723,10 @@ try: x = os.environ['HOME'] except KeyError: - x = os.environ["HOMEDRIVE"] + os.environ['HOMEPATH'] + try: + x = os.environ["HOMEDRIVE"] + os.environ['HOMEPATH'] + except KeyError: + return None return cls(x) _gethomedir = classmethod(_gethomedir) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.15/py/_process/cmdexec.py new/py-1.4.18/py/_process/cmdexec.py --- old/py-1.4.15/py/_process/cmdexec.py 2013-06-21 16:36:31.000000000 +0200 +++ new/py-1.4.18/py/_process/cmdexec.py 2013-10-29 11:34:25.000000000 +0100 @@ -1,8 +1,4 @@ -""" - -""" - -import os, sys +import sys import subprocess import py from subprocess import Popen, PIPE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.15/py/_xmlgen.py new/py-1.4.18/py/_xmlgen.py --- old/py-1.4.15/py/_xmlgen.py 2013-06-21 16:36:31.000000000 +0200 +++ new/py-1.4.18/py/_xmlgen.py 2013-10-29 11:34:25.000000000 +0100 @@ -4,7 +4,6 @@ (c) holger krekel, holger at merlinux eu. 2009 """ -import py import sys, re if sys.version_info >= (3,0): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.15/py.egg-info/PKG-INFO new/py-1.4.18/py.egg-info/PKG-INFO --- old/py-1.4.15/py.egg-info/PKG-INFO 2013-06-21 16:36:31.000000000 +0200 +++ new/py-1.4.18/py.egg-info/PKG-INFO 2013-10-29 11:34:25.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: py -Version: 1.4.15 +Version: 1.4.18 Summary: library with cross-python path, ini-parsing, io, code, log facilities Home-page: http://pylib.readthedocs.org/ Author: holger krekel, Ronny Pfannschmidt, Benjamin Peterson and others diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.15/setup.py new/py-1.4.18/setup.py --- old/py-1.4.15/setup.py 2013-06-21 16:36:31.000000000 +0200 +++ new/py-1.4.18/setup.py 2013-10-29 11:34:25.000000000 +0100 @@ -12,7 +12,7 @@ name='py', description='library with cross-python path, ini-parsing, io, code, log facilities', long_description = open('README.txt').read(), - version='1.4.15', + version='1.4.18', url='http://pylib.readthedocs.org/', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.15/testing/io_/test_terminalwriter.py new/py-1.4.18/testing/io_/test_terminalwriter.py --- old/py-1.4.15/testing/io_/test_terminalwriter.py 2013-06-21 16:36:31.000000000 +0200 +++ new/py-1.4.18/testing/io_/test_terminalwriter.py 2013-10-29 11:34:25.000000000 +0100 @@ -90,6 +90,7 @@ assert s == msg.encode("unicode-escape") +win32 = int(sys.platform == "win32") class TestTerminalWriter: def pytest_generate_tests(self, metafunc): if "tw" in metafunc.funcargnames: @@ -141,13 +142,13 @@ tw.sep("-", fullwidth=60) l = tw.getlines() assert len(l) == 1 - assert l[0] == "-" * 60 + "\n" + assert l[0] == "-" * (60-win32) + "\n" def test_sep_with_title(self, tw): tw.sep("-", "hello", fullwidth=60) l = tw.getlines() assert len(l) == 1 - assert l[0] == "-" * 26 + " hello " + "-" * 27 + "\n" + assert l[0] == "-" * 26 + " hello " + "-" * (27-win32) + "\n" @py.test.mark.skipif("sys.platform == 'win32'") def test__escaped(self, tw): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.15/testing/path/common.py new/py-1.4.18/testing/path/common.py --- old/py-1.4.15/testing/path/common.py 2013-06-21 16:36:31.000000000 +0200 +++ new/py-1.4.18/testing/path/common.py 2013-10-29 11:34:25.000000000 +0100 @@ -38,6 +38,9 @@ p = path1.join('sample') p = p + 'dir' assert p.check() + assert p.exists() + assert p.isdir() + assert not p.isfile() def test_parts(self, path1): newpath = path1.join('sampledir', 'otherfile') @@ -93,12 +96,18 @@ def test_exists(self, path1): assert path1.join("samplefile").check() assert path1.join("samplefile").check(exists=1) + assert path1.join("samplefile").exists() + assert path1.join("samplefile").isfile() + assert not path1.join("samplefile").isdir() def test_dir(self, path1): #print repr(path1.join("sampledir")) assert path1.join("sampledir").check(dir=1) assert path1.join('samplefile').check(notdir=1) assert not path1.join("samplefile").check(dir=1) + assert path1.join("samplefile").exists() + assert not path1.join("samplefile").isdir() + assert path1.join("samplefile").isfile() def test_fnmatch_file(self, path1): assert path1.join("samplefile").check(fnmatch='s*e') @@ -379,6 +388,11 @@ p.remove() assert not p.check() + def test_ensure_dir(self, path1): + b = path1.ensure_dir("001", "002") + assert b.basename == "002" + assert b.isdir() + def test_mkdir_and_remove(self, path1): tmpdir = path1 py.test.raises(py.error.EEXIST, tmpdir.mkdir, 'sampledir') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.15/testing/path/test_local.py new/py-1.4.18/testing/path/test_local.py --- old/py-1.4.15/testing/path/test_local.py 2013-06-21 16:36:31.000000000 +0200 +++ new/py-1.4.18/testing/path/test_local.py 2013-10-29 11:34:25.000000000 +0100 @@ -1,3 +1,6 @@ +# -*- coding: utf-8 -*- + +from __future__ import with_statement import py import pytest import os, sys @@ -75,13 +78,40 @@ def test_initialize_curdir(self): assert str(local()) == py.std.os.getcwd() + @skiponwin32 + def test_chdir_gone(self, path1): + p = path1.ensure("dir_to_be_removed", dir=1) + p.chdir() + p.remove() + pytest.raises(py.error.ENOENT, py.path.local) + assert path1.chdir() is None + assert os.getcwd() == str(path1) + + def test_as_cwd(self, path1): + dir = path1.ensure("subdir", dir=1) + old = py.path.local() + with dir.as_cwd() as x: + assert x == old + assert py.path.local() == dir + assert os.getcwd() == str(old) + + def test_as_cwd_exception(self, path1): + old = py.path.local() + dir = path1.ensure("subdir", dir=1) + with pytest.raises(ValueError): + with dir.as_cwd(): + raise ValueError() + assert old == py.path.local() + def test_initialize_reldir(self, path1): - old = path1.chdir() - try: + with path1.as_cwd(): p = local('samplefile') assert p.check() - finally: - old.chdir() + + @pytest.mark.xfail("sys.version_info < (2,6) and sys.platform == 'win32'") + def test_tilde_expansion(self): + p = py.path.local("~", expanduser=True) + assert p == os.path.expanduser("~") def test_eq_with_strings(self, path1): path1 = path1.join('sampledir') @@ -92,6 +122,31 @@ assert path3 != path2 assert path2 != path3 + def test_eq_with_none(self, path1): + assert path1 != None + + def test_gt_with_strings(self, path1): + path2 = path1.join('sampledir') + path3 = str(path1.join("ttt")) + assert path3 > path2 + assert path2 < path3 + assert path2 < "ttt" + assert "ttt" > path2 + path4 = path1.join("aaa") + l = [path2, path4,path3] + assert sorted(l) == [path4, path2, path3] + + def test_open_and_ensure(self, path1): + p = path1.join("sub1", "sub2", "file") + with p.open("w", ensure=1) as f: + f.write("hello") + assert p.read() == "hello" + + def test_write_and_ensure(self, path1): + p = path1.join("sub1", "sub2", "file") + p.write("hello", ensure=1) + assert p.read() == "hello" + @py.test.mark.multi(bin=(False, True)) def test_dump(self, tmpdir, bin): path = tmpdir.join("dumpfile%s" % int(bin)) @@ -442,19 +497,23 @@ assert not isimportable("x-1") assert not isimportable("x:1") -def test_homedir(): +def test_homedir_from_HOME(monkeypatch): + path = os.getcwd() + monkeypatch.setenv("HOME", path) + assert py.path.local._gethomedir() == py.path.local(path) + +def test_homedir_not_exists(monkeypatch): + monkeypatch.delenv("HOME", raising=False) + monkeypatch.delenv("HOMEDRIVE", raising=False) homedir = py.path.local._gethomedir() - assert homedir.check(dir=1) + assert homedir is None def test_samefile(tmpdir): assert tmpdir.samefile(tmpdir) p = tmpdir.ensure("hello") assert p.samefile(p) - old = p.dirpath().chdir() - try: + with p.dirpath().as_cwd(): assert p.samefile(p.basename) - finally: - old.chdir() if sys.platform == "win32": p1 = p.__class__(str(p).lower()) p2 = p.__class__(str(p).upper()) @@ -510,12 +569,9 @@ def test_sysfind_in_currentdir(self, path1): cmd = py.path.local.sysfind('cmd') root = cmd.new(dirname='', basename='') # c:\ in most installations - old = root.chdir() - try: + with root.as_cwd(): x = py.path.local.sysfind(cmd.relto(root)) assert x.check(file=1) - finally: - old.chdir() class TestPOSIXLocalPath: pytestmark = skiponwin32 @@ -542,6 +598,7 @@ linkpath.mksymlinkto(filepath) assert linkpath.check(file=1) assert not linkpath.check(link=0, file=1) + assert linkpath.islink() def test_symlink_relative(self, tmpdir): linkpath = tmpdir.join('test') @@ -713,3 +770,26 @@ group = path1.stat().group path1.chown(owner, group) + +class TestUnicodePy2Py3: + def test_join_ensure(self, tmpdir): + x = py.path.local(tmpdir.strpath) + part = py.builtin._totext("hällo", "utf8") + y = x.ensure(part) + assert x.join(part) == y + + def test_listdir(self, tmpdir): + x = py.path.local(tmpdir.strpath) + part = py.builtin._totext("hällo", "utf8") + y = x.ensure(part) + assert x.listdir(part)[0] == y + + @pytest.mark.xfail(reason="changing read/write might break existing usages") + def test_read_write(self, tmpdir): + x = tmpdir.join("hello") + part = py.builtin._totext("hällo", "utf8") + x.write(part) + assert x.read() == part + x.write(part.encode(sys.getdefaultencoding())) + assert x.read() == part.encode(sys.getdefaultencoding()) + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.15/testing/root/test_py_imports.py new/py-1.4.18/testing/root/test_py_imports.py --- old/py-1.4.15/testing/root/test_py_imports.py 2013-06-21 16:36:31.000000000 +0200 +++ new/py-1.4.18/testing/root/test_py_imports.py 2013-10-29 11:34:25.000000000 +0100 @@ -27,8 +27,6 @@ def test_importall(): base = py._pydir nodirs = [ - base.join('_path', 'gateway',), - base.join('_code', 'oldmagic.py'), ] if sys.version_info >= (3,0): nodirs.append(base.join('_code', '_assertionold.py')) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.15/tox.ini new/py-1.4.18/tox.ini --- old/py-1.4.15/tox.ini 2013-06-21 16:36:31.000000000 +0200 +++ new/py-1.4.18/tox.ini 2013-10-29 11:34:25.000000000 +0100 @@ -1,5 +1,6 @@ [tox] -envlist=py26,py27,py32,py33,py27-xdist,py25 +envlist=py25,py26,py27,py32,py33,external +# py27-xdist causes problems with svn, py25 requires virtualenv==1.9.1 #indexserver= # default=http://pypi.testrun.org @@ -22,6 +23,9 @@ commands= {envpython} -m pytest --confcutdir=.. -rfsxX --junitxml={envlogdir}/junit-{envname}0.xml {posargs:io_ code} +[testenv:py25] +setenv = PIP_INSECURE=1 + [testenv:external] deps= pytest -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
