|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
nose and jythonHi guys,
I was wondering if anyone tried to run nose under jython? I must confess that most probably I've done something wrong as it doesn't really work for me. I have both Python 2.5.4 and Jython 2.5.0 installed on my Mac OS 10.5.8. nose was initially installed using easy_install for Python 2.5.4. Then I've just copied the nosetests script to the jython bin directory and modified the first line from: #!/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python to #!/Users/alex/bin/jython2.5.0/bin/jython but then I'm seeing the following errors when trying to run nosetests directly from the Terminal /Users/alex/bin/jython2.5.0/bin/nosetests: line 3: __requires__: command not found /Users/alex/bin/jython2.5.0/bin/nosetests: line 4: import: command not found from: can't read /var/mail/pkg_resources /Users/alex/bin/jython2.5.0/bin/nosetests: line 7: syntax error near unexpected token `newline' /Users/alex/bin/jython2.5.0/bin/nosetests: line 7: `sys.exit(' 2. Second attempt was to run jython nosetests test_module.py, but this results in errors too: raceback (most recent call last): File "/Users/alex/bin/jython2.5.0/bin/nosetests", line 5, in <module> from pkg_resources import load_entry_point ImportError: No module named pkg_resources 3. Last I've figured out there might be things installed under Python 2.5.4 that are not available to Jython, so I went to CPYTHON/lib/python2.5/site-packages and copied a couple of things from there and that made it work. Now, I'm wondering what's the best approach for: 1. installing nose for Jython (the correct way) 2. there seems to be a lot of different spots where Python is installing modules, so I'm wondering if there's a recommended way to manage these so I can have a unique place for these to be used from either CPython and Jython Many thanks in advance, ./alex ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Jython-users mailing list Jython-users@... https://lists.sourceforge.net/lists/listinfo/jython-users |
|
|
Re: nose and jythonOn Aug 31, 2009, at 4:23 PM, Alexandru Popescu ☀ wrote: > Hi guys, > > I was wondering if anyone tried to run nose under jython? I must > confess that most probably I've done something wrong as it doesn't > really work for me. > > I have both Python 2.5.4 and Jython 2.5.0 installed on my Mac OS > 10.5.8. nose was initially installed using easy_install for Python > 2.5.4. Then I've just copied the > nosetests script to the jython bin directory and modified the first > line from: > > #!/Library/Frameworks/Python.framework/Versions/2.5/Resources/ > Python.app/Contents/MacOS/Python > > to > > #!/Users/alex/bin/jython2.5.0/bin/jython > > but then I'm seeing the following errors when trying to run nosetests > directly from the Terminal > > /Users/alex/bin/jython2.5.0/bin/nosetests: line 3: __requires__: > command not found > /Users/alex/bin/jython2.5.0/bin/nosetests: line 4: import: command > not found > from: can't read /var/mail/pkg_resources > /Users/alex/bin/jython2.5.0/bin/nosetests: line 7: syntax error near > unexpected token `newline' > /Users/alex/bin/jython2.5.0/bin/nosetests: line 7: `sys.exit(' > > 2. Second attempt was to run jython nosetests test_module.py, but this > results in errors too: > > raceback (most recent call last): > File "/Users/alex/bin/jython2.5.0/bin/nosetests", line 5, in <module> > from pkg_resources import load_entry_point > ImportError: No module named pkg_resources > > 3. Last I've figured out there might be things installed under Python > 2.5.4 that are not available to Jython, so I went to > CPYTHON/lib/python2.5/site-packages and copied a couple of things from > there and that made it work. > > Now, I'm wondering what's the best approach for: > > 1. installing nose for Jython (the correct way) > > 2. there seems to be a lot of different spots where Python is > installing modules, so I'm wondering if there's a recommended way to > manage these so I can > have a unique place for these to be used from either CPython and > Jython The correct way to install nose is the same way you'd install it with CPython, the easiest being with easy_install. Since you need to isolate your Jython packages from CPython packages, I'd highly recommend using virtualenv. It works great with both CPython and Jython -- Philip Jenvey ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Jython-users mailing list Jython-users@... https://lists.sourceforge.net/lists/listinfo/jython-users |
|
|
Re: nose and jythonOn Tue, Sep 1, 2009 at 2:51 AM, Philip Jenvey<pjenvey@...> wrote:
> > On Aug 31, 2009, at 4:23 PM, Alexandru Popescu ☀ wrote: > >> Hi guys, >> >> I was wondering if anyone tried to run nose under jython? I must >> confess that most probably I've done something wrong as it doesn't >> really work for me. >> >> I have both Python 2.5.4 and Jython 2.5.0 installed on my Mac OS >> 10.5.8. nose was initially installed using easy_install for Python >> 2.5.4. Then I've just copied the >> nosetests script to the jython bin directory and modified the first line >> from: >> >> >> #!/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python >> >> to >> >> #!/Users/alex/bin/jython2.5.0/bin/jython >> >> but then I'm seeing the following errors when trying to run nosetests >> directly from the Terminal >> >> /Users/alex/bin/jython2.5.0/bin/nosetests: line 3: __requires__: >> command not found >> /Users/alex/bin/jython2.5.0/bin/nosetests: line 4: import: command not >> found >> from: can't read /var/mail/pkg_resources >> /Users/alex/bin/jython2.5.0/bin/nosetests: line 7: syntax error near >> unexpected token `newline' >> /Users/alex/bin/jython2.5.0/bin/nosetests: line 7: `sys.exit(' >> >> 2. Second attempt was to run jython nosetests test_module.py, but this >> results in errors too: >> >> raceback (most recent call last): >> File "/Users/alex/bin/jython2.5.0/bin/nosetests", line 5, in <module> >> from pkg_resources import load_entry_point >> ImportError: No module named pkg_resources >> >> 3. Last I've figured out there might be things installed under Python >> 2.5.4 that are not available to Jython, so I went to >> CPYTHON/lib/python2.5/site-packages and copied a couple of things from >> there and that made it work. >> >> Now, I'm wondering what's the best approach for: >> >> 1. installing nose for Jython (the correct way) >> >> 2. there seems to be a lot of different spots where Python is >> installing modules, so I'm wondering if there's a recommended way to >> manage these so I can >> have a unique place for these to be used from either CPython and Jython > > > The correct way to install nose is the same way you'd install it with > CPython, the easiest being with easy_install. Since you need to isolate your > Jython packages from CPython packages, I'd highly recommend using > virtualenv. It works great with both CPython and Jython > Thanks Philip, but I don't seem to be able to get setuptools installed with jython. I've setup the PYTHONHOME env variable to point to the jython install and then: sh -v setuptools-0.6c9-py2.5.egg #!/bin/sh if [ `basename $0` = "setuptools-0.6c9-py2.5.egg" ] then exec python2.5 -c "import sys, os; sys.path.insert(0, os.path.abspath('$0')); from setuptools.command.easy_install import bootstrap; sys.exit(bootstrap())" "$@" else echo $0 is not the correct name for this egg file. echo Please rename it back to setuptools-0.6c9-py2.5.egg and try again. exec false fi basename $0 'import site' failed; use -v for traceback Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: No module named os 2. I've looked at some point into virtualenv and I must confess I'd prefer something simpler. But if that's the recommended way I'll check it out again. Before being able to move forward I'll need to get over 1) above though. ./alex > -- > Philip Jenvey > > ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Jython-users mailing list Jython-users@... https://lists.sourceforge.net/lists/listinfo/jython-users |
|
|
Re: nose and jythonOk, found a thread where Frank answered this question already.
Following those steps got me started. I'm reproducing them here just for further reference: 1. download easy_install.py 2. run jython easy_install.py You are done. Running easy_install will install packages in <JYTHON_HOME>/Lib/site-packages ./alex 2009/9/1 Alexandru Popescu ☀ <the.mindstorm.mailinglist@...>: > On Tue, Sep 1, 2009 at 2:51 AM, Philip Jenvey<pjenvey@...> wrote: >> >> On Aug 31, 2009, at 4:23 PM, Alexandru Popescu ☀ wrote: >> >>> Hi guys, >>> >>> I was wondering if anyone tried to run nose under jython? I must >>> confess that most probably I've done something wrong as it doesn't >>> really work for me. >>> >>> I have both Python 2.5.4 and Jython 2.5.0 installed on my Mac OS >>> 10.5.8. nose was initially installed using easy_install for Python >>> 2.5.4. Then I've just copied the >>> nosetests script to the jython bin directory and modified the first line >>> from: >>> >>> >>> #!/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python >>> >>> to >>> >>> #!/Users/alex/bin/jython2.5.0/bin/jython >>> >>> but then I'm seeing the following errors when trying to run nosetests >>> directly from the Terminal >>> >>> /Users/alex/bin/jython2.5.0/bin/nosetests: line 3: __requires__: >>> command not found >>> /Users/alex/bin/jython2.5.0/bin/nosetests: line 4: import: command not >>> found >>> from: can't read /var/mail/pkg_resources >>> /Users/alex/bin/jython2.5.0/bin/nosetests: line 7: syntax error near >>> unexpected token `newline' >>> /Users/alex/bin/jython2.5.0/bin/nosetests: line 7: `sys.exit(' >>> >>> 2. Second attempt was to run jython nosetests test_module.py, but this >>> results in errors too: >>> >>> raceback (most recent call last): >>> File "/Users/alex/bin/jython2.5.0/bin/nosetests", line 5, in <module> >>> from pkg_resources import load_entry_point >>> ImportError: No module named pkg_resources >>> >>> 3. Last I've figured out there might be things installed under Python >>> 2.5.4 that are not available to Jython, so I went to >>> CPYTHON/lib/python2.5/site-packages and copied a couple of things from >>> there and that made it work. >>> >>> Now, I'm wondering what's the best approach for: >>> >>> 1. installing nose for Jython (the correct way) >>> >>> 2. there seems to be a lot of different spots where Python is >>> installing modules, so I'm wondering if there's a recommended way to >>> manage these so I can >>> have a unique place for these to be used from either CPython and Jython >> >> >> The correct way to install nose is the same way you'd install it with >> CPython, the easiest being with easy_install. Since you need to isolate your >> Jython packages from CPython packages, I'd highly recommend using >> virtualenv. It works great with both CPython and Jython >> > > Thanks Philip, but I don't seem to be able to get setuptools installed > with jython. I've setup the PYTHONHOME env variable to point to the > jython install and then: > > sh -v setuptools-0.6c9-py2.5.egg > #!/bin/sh > if [ `basename $0` = "setuptools-0.6c9-py2.5.egg" ] > then exec python2.5 -c "import sys, os; sys.path.insert(0, > os.path.abspath('$0')); from setuptools.command.easy_install import > bootstrap; sys.exit(bootstrap())" "$@" > else > echo $0 is not the correct name for this egg file. > echo Please rename it back to setuptools-0.6c9-py2.5.egg and try again. > exec false > fi > basename $0 > 'import site' failed; use -v for traceback > Traceback (most recent call last): > File "<string>", line 1, in <module> > ImportError: No module named os > > 2. I've looked at some point into virtualenv and I must confess I'd > prefer something simpler. But if that's the recommended way I'll check > it out again. > > Before being able to move forward I'll need to get over 1) above though. > > ./alex > >> -- >> Philip Jenvey >> >> > ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Jython-users mailing list Jython-users@... https://lists.sourceforge.net/lists/listinfo/jython-users |
|
|
Re: nose and jython2009/8/31 Alexandru Popescu ☀ <the.mindstorm.mailinglist@...>:
> Hi guys, > > I was wondering if anyone tried to run nose under jython? I know you already solved the problem, but anyway you may be interested on <http://jythonpodcast.hostjava.net/jythonbook/chapter18.html#nose>. It's our quick coverage of nose usage under Jython, followed by a recipe to use it in conjunction with Hudson for continuous integration, from the upcoming Jython Book. I hope it may be useful to you, and any feedback regarding the book content (which we can still tweak before publication) would be welcomed. Regards, -- Leo Soto M. http://blog.leosoto.com ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Jython-users mailing list Jython-users@... https://lists.sourceforge.net/lists/listinfo/jython-users |
|
|
Re: nose and jython2009/9/1 Leo Soto M. <leo.soto@...>:
> 2009/8/31 Alexandru Popescu ☀ <the.mindstorm.mailinglist@...>: >> Hi guys, >> >> I was wondering if anyone tried to run nose under jython? > > I know you already solved the problem, but anyway you may be > interested on <http://jythonpodcast.hostjava.net/jythonbook/chapter18.html#nose>. > > It's our quick coverage of nose usage under Jython, followed by a > recipe to use it in conjunction with Hudson for continuous > integration, from the upcoming Jython Book. I hope it may be useful to > you, and any feedback regarding the book content (which we can still > tweak before publication) would be welcomed. > Thanks a lot Leo. There's something that doesn't seem to be covered in the book (and is currently something I'm trying to do right now). The question I'm trying to answer is: how can I instruct nosetest to use a CLASSPATH so I can use java classes within my jython tests. To give some more context to the above question: I'm currently working on a project that is written in Java, but I'm using Python for tests and other submodules. While most of the modules are interacting with Java through HTTP. I'd like to be able to use some of my java classes within the jython tests (basically that would allow me to set up the tests without rewriting those configuration bits in jython). Right now I must confess that I have no idea how to do this... so any suggestions are more than welcome! ./alex > Regards, > -- > Leo Soto M. > http://blog.leosoto.com > ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Jython-users mailing list Jython-users@... https://lists.sourceforge.net/lists/listinfo/jython-users |
|
|
Re: nose and jython2009/9/3 Alexandru Popescu ☀ <the.mindstorm.mailinglist@...>:
> The question I'm trying to answer is: how can I instruct nosetest to > use a CLASSPATH so I can use java classes within my jython tests. > > To give some more context to the above question: I'm currently working > on a project that is written in Java, but I'm using Python for tests > and other submodules. While most of the modules are interacting with > Java through HTTP. I'd like to be able to use some of my java classes > within the jython tests (basically that would allow me to set up the > tests without rewriting those configuration bits in jython). This is a different direction than the one you've gone down with virtualenv, but I'm using nose to run Python tests that use Java classes in clamp, so I thought I'd share how I'm doing that. I'm using Ant for everything, and from my build.xml, I call Jython with a CLASSPATH environmental variable set up to include my built Java and the test classes. I add a JYTHONPATH variable pointing to a nose jar to get those to Jython, and a final NOSE_WHERE variable pointing to my tests. You can see the nose invocation at http://github.com/groves/clamp/blob/ae3848d06c3aac5c381b9f6e1c435dca7e645a1f/build.xml#L76 nose.zip is just a zip file containing a compiled version of the .py files from nose to make things run a little faster. There's another target to create that towards the end of the build file. Charlie ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Jython-users mailing list Jython-users@... https://lists.sourceforge.net/lists/listinfo/jython-users |
|
|
Re: nose and jython2009/9/3 Alexandru Popescu ☀ <the.mindstorm.mailinglist@...>:
[...] > Thanks a lot Leo. There's something that doesn't seem to be covered in > the book (and is currently something I'm trying to do right now). > > The question I'm trying to answer is: how can I instruct nosetest to > use a CLASSPATH so I can use java classes within my jython tests. Good point. It should be matter of setting the CLASSPATH environment variable when calling nose. Something like: $ CLASSPATH=/path/to/my/library.jar nosetests -- Leo Soto M. http://blog.leosoto.com ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Jython-users mailing list Jython-users@... https://lists.sourceforge.net/lists/listinfo/jython-users |
| Free embeddable forum powered by Nabble | Forum Help |