Hello community, here is the log from the commit of package python-py for openSUSE:Factory checked in at 2015-07-05 17:55:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-py (Old) and /work/SRC/openSUSE:Factory/.python-py.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-py" Changes: -------- New Changes file: --- /dev/null 2015-06-25 09:04:34.320025005 +0200 +++ /work/SRC/openSUSE:Factory/.python-py.new/python-py-doc.changes 2015-07-05 17:55:41.000000000 +0200 @@ -0,0 +1,5 @@ +------------------------------------------------------------------- +Tue Jun 30 13:45:03 UTC 2015 - a...@ajaissle.de + +- Split documentation into separate package to avoid build loop + --- /work/SRC/openSUSE:Factory/python-py/python-py.changes 2015-02-06 22:35:53.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.python-py.new/python-py.changes 2015-07-05 17:55:41.000000000 +0200 @@ -1,0 +2,17 @@ +Tue Jun 30 13:45:03 UTC 2015 - a...@ajaissle.de + +- Split documentation into separate package to avoid build loop + +------------------------------------------------------------------- +Mon Jun 22 15:13:02 UTC 2015 - tbecht...@suse.com + +- update to 1.4.28: + - fix issue64 -- dirpath regression when "abs=True" is passed. + - fix issue59: point to new repo site + - allow a new ensuresyspath="append" mode for py.path.local.pyimport() + so that a neccessary import path is appended instead of prepended to + sys.path + - strike undocumented, untested argument to py.path.local.pypkgpath + - speed up py.path.local.dirpath by a factor of 10 + +------------------------------------------------------------------- Old: ---- py-1.4.26.tar.gz New: ---- py-1.4.28.tar.gz python-py-doc.changes python-py-doc.spec ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-py-doc.spec ++++++ # # spec file for package python-py-doc # # Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # Name: python-py-doc Version: 1.4.28 Release: 0 Summary: Library with cross-python path, ini-parsing, io, code, log facilities License: MIT Group: Development/Languages/Python Url: http://pylib.org Source: http://pypi.python.org/packages/source/p/py/py-%{version}.tar.gz # Documentation requirements: BuildRequires: python-Sphinx BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?suse_version} && 0%{?suse_version} <= 1110 %{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %else BuildArch: noarch %endif %description The py lib is a Python development support library featuring the following tools and modules: * py.path: uniform local and svn path objects * py.apipkg: explicit API control and lazy-importing * py.iniconfig: easy parsing of .ini files * py.code: dynamic code generation and introspection * py.path: uniform local and svn path objects This package contains the documentation for Babel %prep %setup -q -n py-%{version} %build cd doc && make html && rm -r _build/html/.buildinfo %install # Only building documentation %files %defattr(-,root,root,-) %doc LICENSE doc/_build/html %changelog ++++++ python-py.spec ++++++ --- /var/tmp/diff_new_pack.8NeK84/_old 2015-07-05 17:55:42.000000000 +0200 +++ /var/tmp/diff_new_pack.8NeK84/_new 2015-07-05 17:55:42.000000000 +0200 @@ -17,7 +17,7 @@ Name: python-py -Version: 1.4.26 +Version: 1.4.28 Release: 0 Summary: Library with cross-python path, ini-parsing, io, code, log facilities License: MIT @@ -25,8 +25,7 @@ Url: http://pylib.org Source: http://pypi.python.org/packages/source/p/py/py-%{version}.tar.gz BuildRequires: python-devel -# Documentation requirements: -BuildRequires: python-Sphinx +BuildRequires: python-setuptools BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?suse_version} && 0%{?suse_version} <= 1110 %{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} @@ -49,14 +48,13 @@ %build python setup.py build -cd doc && make html && rm -r _build/html/.buildinfo # Generate HTML documentation %install python setup.py install --prefix=%{_prefix} --root=%{buildroot} %files %defattr(-,root,root,-) -%doc LICENSE README.txt doc/_build/html +%doc LICENSE README.txt %{python_sitelib}/* %changelog ++++++ py-1.4.26.tar.gz -> py-1.4.28.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.26/CHANGELOG new/py-1.4.28/CHANGELOG --- old/py-1.4.26/CHANGELOG 2014-10-24 13:56:34.000000000 +0200 +++ new/py-1.4.28/CHANGELOG 2015-05-22 08:30:55.000000000 +0200 @@ -1,3 +1,22 @@ +1.4.28 +================================================== + +- fix issue64 -- dirpath regression when "abs=True" is passed. + Thanks Gilles Dartiguelongue. + +1.4.27 +================================================== + +- fix issue59: point to new repo site + +- allow a new ensuresyspath="append" mode for py.path.local.pyimport() + so that a neccessary import path is appended instead of prepended to + sys.path + +- strike undocumented, untested argument to py.path.local.pypkgpath + +- speed up py.path.local.dirpath by a factor of 10 + 1.4.26 ================================================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.26/PKG-INFO new/py-1.4.28/PKG-INFO --- old/py-1.4.26/PKG-INFO 2014-10-24 13:56:34.000000000 +0200 +++ new/py-1.4.28/PKG-INFO 2015-05-22 08:30:56.000000000 +0200 @@ -1,28 +1,32 @@ Metadata-Version: 1.1 Name: py -Version: 1.4.26 +Version: 1.4.28 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 Author-email: pytest-...@python.org License: MIT license -Description: The py lib is a Python development support library featuring - the following tools and modules: - - * py.path: uniform local and svn path objects - * py.apipkg: explicit API control and lazy-importing - * py.iniconfig: easy parsing of .ini files - * py.code: dynamic code generation and introspection - - NOTE: prior to the 1.4 release this distribution used to - contain py.test which is now its own package, see http://pytest.org - - For questions and more information please visit http://pylib.readthedocs.org - - Bugs and issues: http://bitbucket.org/hpk42/py/issues/ - - Authors: Holger Krekel and others, 2004-2014 - +Description: .. image:: https://drone.io/bitbucket.org/pytest-dev/py/status.png + :target: https://drone.io/bitbucket.org/pytest-dev/py/latest + .. image:: https://pypip.in/v/py/badge.png + :target: https://pypi.python.org/pypi/py + + The py lib is a Python development support library featuring + the following tools and modules: + + * py.path: uniform local and svn path objects + * py.apipkg: explicit API control and lazy-importing + * py.iniconfig: easy parsing of .ini files + * py.code: dynamic code generation and introspection + + NOTE: prior to the 1.4 release this distribution used to + contain py.test which is now its own package, see http://pytest.org + + For questions and more information please visit http://pylib.readthedocs.org + + Bugs and issues: http://bitbucket.org/pytest-dev/py/issues/ + + Authors: Holger Krekel and others, 2004-2015 Platform: unix Platform: linux diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.26/README.txt new/py-1.4.28/README.txt --- old/py-1.4.26/README.txt 2014-10-24 13:56:34.000000000 +0200 +++ new/py-1.4.28/README.txt 2015-05-22 08:30:55.000000000 +0200 @@ -1,17 +1,21 @@ -The py lib is a Python development support library featuring -the following tools and modules: - -* py.path: uniform local and svn path objects -* py.apipkg: explicit API control and lazy-importing -* py.iniconfig: easy parsing of .ini files -* py.code: dynamic code generation and introspection - -NOTE: prior to the 1.4 release this distribution used to -contain py.test which is now its own package, see http://pytest.org - -For questions and more information please visit http://pylib.readthedocs.org - -Bugs and issues: http://bitbucket.org/hpk42/py/issues/ - -Authors: Holger Krekel and others, 2004-2014 - +.. image:: https://drone.io/bitbucket.org/pytest-dev/py/status.png + :target: https://drone.io/bitbucket.org/pytest-dev/py/latest +.. image:: https://pypip.in/v/py/badge.png + :target: https://pypi.python.org/pypi/py + +The py lib is a Python development support library featuring +the following tools and modules: + +* py.path: uniform local and svn path objects +* py.apipkg: explicit API control and lazy-importing +* py.iniconfig: easy parsing of .ini files +* py.code: dynamic code generation and introspection + +NOTE: prior to the 1.4 release this distribution used to +contain py.test which is now its own package, see http://pytest.org + +For questions and more information please visit http://pylib.readthedocs.org + +Bugs and issues: http://bitbucket.org/pytest-dev/py/issues/ + +Authors: Holger Krekel and others, 2004-2015 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.26/py/__init__.py new/py-1.4.28/py/__init__.py --- old/py-1.4.26/py/__init__.py 2014-10-24 13:56:34.000000000 +0200 +++ new/py-1.4.28/py/__init__.py 2015-05-22 08:30:55.000000000 +0200 @@ -8,7 +8,7 @@ (c) Holger Krekel and others, 2004-2014 """ -__version__ = '1.4.26' +__version__ = '1.4.28' from py import _apipkg diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.26/py/_builtin.py new/py-1.4.28/py/_builtin.py --- old/py-1.4.26/py/_builtin.py 2014-10-24 13:56:34.000000000 +0200 +++ new/py-1.4.28/py/_builtin.py 2015-05-22 08:30:55.000000000 +0200 @@ -220,7 +220,7 @@ locals = globals exec2(obj, globals, locals) -if sys.version_info >= (3,0): +if sys.version_info >= (3, 0): def _reraise(cls, val, tb): __tracebackhide__ = True assert hasattr(val, '__traceback__') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.26/py/_code/source.py new/py-1.4.28/py/_code/source.py --- old/py-1.4.26/py/_code/source.py 2014-10-24 13:56:34.000000000 +0200 +++ new/py-1.4.28/py/_code/source.py 2015-05-22 08:30:55.000000000 +0200 @@ -375,15 +375,17 @@ # - there might be empty lines if end is None: end = len(source.lines) - while end: - line = source.lines[end-1].lstrip() - if (not line - or line.startswith("#") - or line.replace(" ", "") == "else:" - or line.replace(" ", "") == "finally:"): - end -= 1 - else: + import re + prefix = re.match(r"\s*", source.lines[start]).group() + i = start+1 + while i < end: + line = source.lines[i] + if not line or len(line)<len(prefix) or line[:len(prefix)]!=prefix: break + rem = line[len(prefix):].lstrip() + if not rem or rem[0]=='#': break + i += 1 + end = i return astnode, start, end def getstatementrange_old(lineno, source, assertion=False): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.26/py/_io/terminalwriter.py new/py-1.4.28/py/_io/terminalwriter.py --- old/py-1.4.26/py/_io/terminalwriter.py 2014-10-24 13:56:34.000000000 +0200 +++ new/py-1.4.28/py/_io/terminalwriter.py 2015-05-22 08:30:55.000000000 +0200 @@ -31,17 +31,24 @@ def get_terminal_width(): + height = width = 0 try: height, width = _getdimensions() except py.builtin._sysex: raise except: - # FALLBACK + # pass to fallback below + pass + + if width == 0: + # FALLBACK: + # * some exception happened + # * or this is emacs terminal which reports (0,0) width = int(os.environ.get('COLUMNS', 80)) - else: - # XXX the windows getdimensions may be bogus, let's sanify a bit - if width < 40: - width = 80 + + # XXX the windows getdimensions may be bogus, let's sanify a bit + if width < 40: + width = 80 return width terminal_width = get_terminal_width() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.26/py/_path/common.py new/py-1.4.28/py/_path/common.py --- old/py-1.4.26/py/_path/common.py 2014-10-24 13:56:34.000000000 +0200 +++ new/py-1.4.28/py/_path/common.py 2015-05-22 08:30:55.000000000 +0200 @@ -113,9 +113,7 @@ ext = property(ext, None, None, ext.__doc__) def dirpath(self, *args, **kwargs): - """ return the directory Path of the current Path joined - with any given path arguments. - """ + """ return the directory path joined with any given path arguments. """ return self.new(basename='').join(*args, **kwargs) def read_binary(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.26/py/_path/local.py new/py-1.4.28/py/_path/local.py --- old/py-1.4.26/py/_path/local.py 2014-10-24 13:56:34.000000000 +0200 +++ new/py-1.4.28/py/_path/local.py 2015-05-22 08:30:55.000000000 +0200 @@ -10,7 +10,7 @@ from py._path.common import iswin32 from stat import S_ISLNK, S_ISDIR, S_ISREG -from os.path import abspath, normpath, isabs, exists, isdir, isfile, islink +from os.path import abspath, normpath, isabs, exists, isdir, isfile, islink, dirname if sys.version_info > (3,0): def map_as_list(func, iter): @@ -304,6 +304,16 @@ raise ValueError("invalid part specification %r" % name) return res + def dirpath(self, *args, **kwargs): + """ return the directory path joined with any given path arguments. """ + if not kwargs: + path = object.__new__(self.__class__) + path.strpath = dirname(self.strpath) + if args: + path = path.join(*args) + return path + return super(LocalPath, self).dirpath(*args, **kwargs) + def join(self, *args, **kwargs): """ return a new path by appending all 'args' as path components. if abs=1 is used restart from root if any @@ -570,35 +580,6 @@ """ return string representation of the Path. """ return self.strpath - def pypkgpath(self, pkgname=None): - """ return the Python package path by looking for a - pkgname. If pkgname is None look for the last - directory upwards which still contains an __init__.py - and whose basename is python-importable. - Return None if a pkgpath can not be determined. - """ - pkgpath = None - for parent in self.parts(reverse=True): - if pkgname is None: - if parent.check(file=1): - continue - if not isimportable(parent.basename): - break - if parent.join('__init__.py').check(): - pkgpath = parent - continue - return pkgpath - else: - if parent.basename == pkgname: - return parent - return pkgpath - - def _prependsyspath(self, path): - s = str(path) - if s != sys.path[0]: - #print "prepending to sys.path", s - sys.path.insert(0, s) - def chmod(self, mode, rec=0): """ change permissions to the given mode. If mode is an integer it directly encodes the os-specific modes. @@ -611,33 +592,61 @@ py.error.checked_call(os.chmod, str(x), mode) py.error.checked_call(os.chmod, str(self), mode) + def pypkgpath(self): + """ return the Python package path by looking for the last + directory upwards which still contains an __init__.py. + Return None if a pkgpath can not be determined. + """ + pkgpath = None + for parent in self.parts(reverse=True): + if parent.isdir(): + if not parent.join('__init__.py').exists(): + break + if not isimportable(parent.basename): + break + pkgpath = parent + return pkgpath + + def _ensuresyspath(self, ensuremode, path): + if ensuremode: + s = str(path) + if ensuremode == "append": + if s not in sys.path: + sys.path.append(s) + else: + if s != sys.path[0]: + sys.path.insert(0, s) + def pyimport(self, modname=None, ensuresyspath=True): """ return path as an imported python module. - if modname is None, look for the containing package - and construct an according module name. - The module will be put/looked up in sys.modules. + + If modname is None, look for the containing package + and construct an according module name. + The module will be put/looked up in sys.modules. + if ensuresyspath is True then the root dir for importing + the file (taking __init__.py files into account) will + be prepended to sys.path if it isn't there already. + If ensuresyspath=="append" the root dir will be appended + if it isn't already contained in sys.path. + if ensuresyspath is False no modification of syspath happens. """ if not self.check(): raise py.error.ENOENT(self) - #print "trying to import", self + pkgpath = None if modname is None: pkgpath = self.pypkgpath() if pkgpath is not None: - if ensuresyspath: - self._prependsyspath(pkgpath.dirpath()) - __import__(pkgpath.basename) - pkg = sys.modules[pkgpath.basename] - names = self.new(ext='').relto(pkgpath.dirpath()) - names = names.split(self.sep) - if names and names[-1] == "__init__": + pkgroot = pkgpath.dirpath() + names = self.new(ext="").relto(pkgroot).split(self.sep) + if names[-1] == "__init__": names.pop() modname = ".".join(names) else: - # no package scope, still make it possible - if ensuresyspath: - self._prependsyspath(self.dirpath()) + pkgroot = self.dirpath() modname = self.purebasename + + self._ensuresyspath(ensuresyspath, pkgroot) __import__(modname) mod = sys.modules[modname] if self.basename == "__init__.py": @@ -651,7 +660,6 @@ if modfile.endswith(os.path.sep + "__init__.py"): if self.basename != "__init__.py": modfile = modfile[:-12] - try: issame = self.samefile(modfile) except py.error.ENOENT: @@ -898,8 +906,6 @@ fsrc.close() def isimportable(name): - if name: - if not (name[0].isalpha() or name[0] == '_'): - return False - name= name.replace("_", '') + if name and (name[0].isalpha() or name[0] == '_'): + name = name.replace("_", '') return not name or name.isalnum() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.26/py.egg-info/PKG-INFO new/py-1.4.28/py.egg-info/PKG-INFO --- old/py-1.4.26/py.egg-info/PKG-INFO 2014-10-24 13:56:34.000000000 +0200 +++ new/py-1.4.28/py.egg-info/PKG-INFO 2015-05-22 08:30:56.000000000 +0200 @@ -1,28 +1,32 @@ Metadata-Version: 1.1 Name: py -Version: 1.4.26 +Version: 1.4.28 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 Author-email: pytest-...@python.org License: MIT license -Description: The py lib is a Python development support library featuring - the following tools and modules: - - * py.path: uniform local and svn path objects - * py.apipkg: explicit API control and lazy-importing - * py.iniconfig: easy parsing of .ini files - * py.code: dynamic code generation and introspection - - NOTE: prior to the 1.4 release this distribution used to - contain py.test which is now its own package, see http://pytest.org - - For questions and more information please visit http://pylib.readthedocs.org - - Bugs and issues: http://bitbucket.org/hpk42/py/issues/ - - Authors: Holger Krekel and others, 2004-2014 - +Description: .. image:: https://drone.io/bitbucket.org/pytest-dev/py/status.png + :target: https://drone.io/bitbucket.org/pytest-dev/py/latest + .. image:: https://pypip.in/v/py/badge.png + :target: https://pypi.python.org/pypi/py + + The py lib is a Python development support library featuring + the following tools and modules: + + * py.path: uniform local and svn path objects + * py.apipkg: explicit API control and lazy-importing + * py.iniconfig: easy parsing of .ini files + * py.code: dynamic code generation and introspection + + NOTE: prior to the 1.4 release this distribution used to + contain py.test which is now its own package, see http://pytest.org + + For questions and more information please visit http://pylib.readthedocs.org + + Bugs and issues: http://bitbucket.org/pytest-dev/py/issues/ + + Authors: Holger Krekel and others, 2004-2015 Platform: unix Platform: linux diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.26/setup.py new/py-1.4.28/setup.py --- old/py-1.4.26/setup.py 2014-10-24 13:56:34.000000000 +0200 +++ new/py-1.4.28/setup.py 2015-05-22 08:30:55.000000000 +0200 @@ -7,7 +7,7 @@ name='py', description='library with cross-python path, ini-parsing, io, code, log facilities', long_description = open('README.txt').read(), - version='1.4.26', + version='1.4.28', 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.26/testing/code/test_source.py new/py-1.4.28/testing/code/test_source.py --- old/py-1.4.26/testing/code/test_source.py 2014-10-24 13:56:34.000000000 +0200 +++ new/py-1.4.28/testing/code/test_source.py 2015-05-22 08:30:55.000000000 +0200 @@ -489,6 +489,25 @@ source = getstatement(0, "raise ValueError\n#hello") assert str(source) == "raise ValueError" +def test_comments(): + source = '''def test(): + "comment 1" + x = 1 + # comment 2 + # comment 3 + + assert False + +""" +comment 4 +""" +''' + for line in range(2,6): + assert str(getstatement(line, source)) == ' x = 1' + for line in range(6,10): + assert str(getstatement(line, source)) == ' assert False' + assert str(getstatement(10, source)) == '"""' + def test_single_line_else(): source = getstatement(1, "if False: 2\nelse: 3") assert str(source) == "else: 3" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.26/testing/io_/test_terminalwriter.py new/py-1.4.28/testing/io_/test_terminalwriter.py --- old/py-1.4.26/testing/io_/test_terminalwriter.py 2014-10-24 13:56:34.000000000 +0200 +++ new/py-1.4.28/testing/io_/test_terminalwriter.py 2015-05-22 08:30:55.000000000 +0200 @@ -42,6 +42,13 @@ tw = py.io.TerminalWriter() assert tw.fullwidth == 80 +def test_terminalwriter_getdimensions_emacs(monkeypatch): + # emacs terminal returns (0,0) but set COLUMNS properly + monkeypatch.setattr(terminalwriter, '_getdimensions', lambda: (0,0)) + monkeypatch.setenv('COLUMNS', '42') + tw = py.io.TerminalWriter() + assert tw.fullwidth == 42 + def test_terminalwriter_computes_width(monkeypatch): monkeypatch.setattr(terminalwriter, 'get_terminal_width', lambda: 42) tw = py.io.TerminalWriter() @@ -262,4 +269,3 @@ tw.line("hello", bold=True) s = f.getvalue() assert s == "hello\n" - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/py-1.4.26/testing/path/test_local.py new/py-1.4.28/testing/path/test_local.py --- old/py-1.4.26/testing/path/test_local.py 2014-10-24 13:56:34.000000000 +0200 +++ new/py-1.4.28/testing/path/test_local.py 2015-05-22 08:30:55.000000000 +0200 @@ -34,6 +34,12 @@ p = tmpdir.join("..//%s/" % tmpdir.basename) assert p == tmpdir + @skiponwin32 + def test_dirpath_abs_no_abs(self, tmpdir): + p = tmpdir.join('foo') + assert p.dirpath('/bar') == tmpdir.join('bar') + assert tmpdir.dirpath('/bar', abs=True) == py.path.local('/bar') + def test_gethash(self, tmpdir): md5 = py.builtin._tryimport('md5', 'hashlib').md5 lib = py.builtin._tryimport('sha', 'hashlib') @@ -479,6 +485,15 @@ m2 = p2.pyimport() assert m1 == m2 + def test_ensuresyspath_append(self, tmpdir): + root1 = tmpdir.mkdir("root1") + file1 = root1.ensure("x123.py") + assert str(root1) not in sys.path + file1.pyimport(ensuresyspath="append") + assert str(root1) == sys.path[-1] + assert str(root1) not in sys.path[:-1] + + def test_pypkgdir(tmpdir): pkg = tmpdir.ensure('pkg1', dir=1) pkg.ensure("__init__.py") @@ -789,15 +804,19 @@ class TestUnicodePy2Py3: - def test_join_ensure(self, tmpdir): + def test_join_ensure(self, tmpdir, monkeypatch): + if sys.version_info >= (3,0) and "LANG" not in os.environ: + pytest.skip("cannot run test without locale") x = py.path.local(tmpdir.strpath) - part = py.builtin._totext("hällo", "utf8") + part = "hällo" y = x.ensure(part) assert x.join(part) == y def test_listdir(self, tmpdir): + if sys.version_info >= (3,0) and "LANG" not in os.environ: + pytest.skip("cannot run test without locale") x = py.path.local(tmpdir.strpath) - part = py.builtin._totext("hällo", "utf8") + part = "hällo" y = x.ensure(part) assert x.listdir(part)[0] == y