[py-dev] Call py.test.cmdline.main() from a python script

Jan Balster jan at balster.info
Thu Dec 1 15:44:45 CET 2005


Hello Rudá,

I submitted this patch (r20499) to py-lib.
It should solve your problem.

--- py/path/local/local.py (revision 20475)
+++ py/path/local/local.py (working copy)
@@ -372,7 +372,8 @@
                 if ensuresyspath:
                     self._prependsyspath(pkgpath.dirpath())
                 pkg = __import__(pkgpath.basename, None, None, [])
-                assert py.path.local(pkg.__file__).relto(pkgpath)
+                assert py.path.local(pkg.__file__).realpath().relto(
+                    pkgpath.realpath())
                 if hasattr(pkg, '__package__'):
                     modname = pkg.__package__.getimportname(self)
                     assert modname is not None, "package %s doesn't know %s" % (



I didn't submit your patch, because it breaks the expected behavior of
py.path.local when working with symbolic links.

Example:

>>> import py
>>> py.path.local('file').ensure()
local('.../file')
>>> py.path.local('symlink').mksymlinkto(py.path.local('file'))
>>> py.path.local().listdir()
[local('.../file'), local('.../symlink')]
>>> py.path.local().join('symlink')
local('.../symlink')
>>> py.path.local('symlink')
local('.../file')

Is that your svn repository?
http://svn.async.com.br/cgi-bin/viewcvs.cgi/Stoq2/?rev=804
Just curious, because I couldn't find any py.test tests ;-)

Jan


More information about the py-dev mailing list