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

Ruda Filgueiras rudazz at gmail.com
Thu Dec 1 16:37:30 CET 2005


2005/12/1, Jan Balster <jan at balster.info>:
> Hello Rudá,
Hi.

> 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" % (

Thanks!

> 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')

Ok! I test with your patch and everything works fine!

> 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 ;-)

This is the tests folder, but some tests will be commited sonn.
http://svn.async.com.br/cgi-bin/viewcvs.cgi/stoq/trunk/stoq/tests/

This is the svn repository:
svn://www.async.com.br/stoq/trunk

--
Rudá Porto Filgueiras
Empresa Livre
http://www.empresalivre.com.br



More information about the Pytest-dev mailing list