From jan at balster.info Thu Dec 1 15:44:45 2005 From: jan at balster.info (Jan Balster) Date: Thu, 01 Dec 2005 15:44:45 +0100 Subject: [py-dev] Call py.test.cmdline.main() from a python script In-Reply-To: <776143310511301342q665e47d7h@mail.gmail.com> References: <776143310511301342q665e47d7h@mail.gmail.com> Message-ID: <438F0C5D.1050103@balster.info> 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 From rudazz at gmail.com Thu Dec 1 16:37:30 2005 From: rudazz at gmail.com (Ruda Filgueiras) Date: Thu, 1 Dec 2005 13:37:30 -0200 Subject: [py-dev] Call py.test.cmdline.main() from a python script In-Reply-To: <438F0C5D.1050103@balster.info> References: <776143310511301342q665e47d7h@mail.gmail.com> <438F0C5D.1050103@balster.info> Message-ID: <776143310512010737k7da25a0al@mail.gmail.com> 2005/12/1, Jan Balster : > 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