Discussion:
[Pydev-users] importing test code, that is below normal code
peter
2015-12-08 11:41:28 UTC
Permalink
hi,



from the commandline in can run:
python -m code/tests/distance_test


in the test class i got:
from code.find-1-motif-brute-force import y,x,z

tests are under tests, and code is in code.


how can i do this with eclipse/pydev?
Fabio Zadrozny
2015-12-08 11:47:57 UTC
Permalink
I'm not sure I understood what you meant, so, let me try to guess here...

In PyDev you just need to set the source folders (which are the folders in
your PYTHONPATH) -- see: http://www.pydev.org/manual_101_project_conf2.html
for details

Then you can run the file with F9, or if it's a test case with Ctrl+F9 --
see: http://www.pydev.org/manual_101_run.html for details.

Hope that's what needed to get you going...

Best Regards,

Fabio
Post by peter
hi,
python -m code/tests/distance_test
from code.find-1-motif-brute-force import y,x,z
tests are under tests, and code is in code.
how can i do this with eclipse/pydev?
------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple
OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Pydev-users mailing list
https://lists.sourceforge.net/lists/listinfo/pydev-users
Nathan Schneider
2015-12-08 11:53:27 UTC
Permalink
Also note that hyphens are invalid in module names without special tricks:
http://stackoverflow.com/questions/7583652/python-module-with-a-dash-or-hyphen-in-its-name
.

Best,
Nathan
Post by Fabio Zadrozny
I'm not sure I understood what you meant, so, let me try to guess here...
In PyDev you just need to set the source folders (which are the folders in
http://www.pydev.org/manual_101_project_conf2.html for details
Then you can run the file with F9, or if it's a test case with Ctrl+F9 --
see: http://www.pydev.org/manual_101_run.html for details.
Hope that's what needed to get you going...
Best Regards,
Fabio
Post by peter
hi,
python -m code/tests/distance_test
from code.find-1-motif-brute-force import y,x,z
tests are under tests, and code is in code.
how can i do this with eclipse/pydev?
------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple
OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Pydev-users mailing list
https://lists.sourceforge.net/lists/listinfo/pydev-users
------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple
OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Pydev-users mailing list
https://lists.sourceforge.net/lists/listinfo/pydev-users
peter
2015-12-08 12:16:34 UTC
Permalink
i should have posted the error message, lets try it again:

project looks like this:
Loading Image...

since i used the pydev wizard to create the project, the files should be
in the PYTHONPATH.

now i run the file:
distance_test.py as python unit test


error i get:
Traceback (most recent call last):
File
"/home/julius/Downloads/eclipse-java-mars-1-linux-gtk-x86_64/plugins/org.python.pydev_4.4.0.201510052309/pysrc/pydev_runfiles.py",
line 468, in __get_module_from_str
mod = __import__(modname)
File
"/home/julius/workspace-mars/Bachelorarbeit/tests/distance_test.py", line 2
from code.find-1-motif-brute-force import is_trivial_match,
find_motif_brute_force
^
SyntaxError: invalid syntax
ERROR: Module: distance_test could not be imported (file:
/home/julius/workspace-mars/Bachelorarbeit/tests/distance_test.py).



@nathan: i will change the hyphens, but this project works when run from
console.
Post by Fabio Zadrozny
I'm not sure I understood what you meant, so, let me try to guess here...
In PyDev you just need to set the source folders (which are the
http://www.pydev.org/manual_101_project_conf2.html for details
Then you can run the file with F9, or if it's a test case with Ctrl+F9
-- see: http://www.pydev.org/manual_101_run.html for details.
Hope that's what needed to get you going...
Best Regards,
Fabio
hi,
python -m code/tests/distance_test
from code.find-1-motif-brute-force import y,x,z
tests are under tests, and code is in code.
how can i do this with eclipse/pydev?
------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for
multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Fabio Zadrozny
2015-12-08 12:29:30 UTC
Permalink
Post by peter
http://erntehelfer.ddns.net/tmp/test.png
since i used the pydev wizard to create the project, the files should be
in the PYTHONPATH.
distance_test.py as python unit test
File
"/home/julius/Downloads/eclipse-java-mars-1-linux-gtk-x86_64/plugins/org.python.pydev_4.4.0.201510052309/pysrc/pydev_runfiles.py",
line 468, in __get_module_from_str
mod = __import__(modname)
File
"/home/julius/workspace-mars/Bachelorarbeit/tests/distance_test.py", line 2
from code.find-1-motif-brute-force import is_trivial_match,
find_motif_brute_force
^
SyntaxError: invalid syntax
/home/julius/workspace-mars/Bachelorarbeit/tests/distance_test.py).
@nathan: i will change the hyphens, but this project works when run from
console.
Humm, really weird that it works in the console (it doesn't make much
sense... having hyphen characters in the import isn't allowed as far as I
know and should really give you a syntax error as that's not a valid python
name).

The real fix should be really changing the hyphens for underscores.

Best Regards,

Fabio
peter
2015-12-08 13:04:09 UTC
Permalink
Post by peter
http://erntehelfer.ddns.net/tmp/test.png
since i used the pydev wizard to create the project, the files
should be in the PYTHONPATH.
distance_test.py as python unit test
File
"/home/julius/Downloads/eclipse-java-mars-1-linux-gtk-x86_64/plugins/org.python.pydev_4.4.0.201510052309/pysrc/pydev_runfiles.py",
line 468, in __get_module_from_str
mod = __import__(modname)
File
"/home/julius/workspace-mars/Bachelorarbeit/tests/distance_test.py", line 2
from code.find-1-motif-brute-force import is_trivial_match,
find_motif_brute_force
^
SyntaxError: invalid syntax
/home/julius/workspace-mars/Bachelorarbeit/tests/distance_test.py).
@nathan: i will change the hyphens, but this project works when
run from console.
Humm, really weird that it works in the console (it doesn't make much
sense... having hyphen characters in the import isn't allowed as far
as I know and should really give you a syntax error as that's not a
valid python name).
The real fix should be really changing the hyphens for underscores.
Best Regards,
Fabio
found it, the part "code." was wrong, and i changed one file from only
methods to a class.
sry, forgot about that
thx for the support
peter
2015-12-08 19:44:24 UTC
Permalink
hi,


have you considered putting the autocompletion window below the current
line, and not above?
i feel it kinda blocks my view.....maybe if it would pop up a few lines
above the cursor
so you have some context when you add code, that might be relevant for
the current input.
do you know what i mean?

thats why i usually disable that future.

greetings
Fabio Zadrozny
2015-12-09 09:40:20 UTC
Permalink
Post by peter
hi,
have you considered putting the autocompletion window below the current
line, and not above?
i feel it kinda blocks my view.....maybe if it would pop up a few lines
above the cursor
so you have some context when you add code, that might be relevant for
the current input.
do you know what i mean?
thats why i usually disable that future.
​
Not sure I follow
​... it does seem correct for me (you can see a screenshot at:
http://imgur.com/mM9klEB
​)​
​
​.

If that's not what you have, please create a bug report (at
https://sw-brainwy.rhcloud.com/tracker/PyDev) providing details on your
platform/eclipse version and a screenshot (you can upload it to imgur).

Best Regards,

Fabio
peter
2015-12-10 11:53:53 UTC
Permalink
Post by peter
hi,
have you considered putting the autocompletion window below the current
line, and not above?
i feel it kinda blocks my view.....maybe if it would pop up a few lines
above the cursor
so you have some context when you add code, that might be relevant for
the current input.
do you know what i mean?
thats why i usually disable that future.
​
Not sure I follow
http://imgur.com/mM9klEB
​)​
​
​.
If that's not what you have, please create a bug report (at
https://sw-brainwy.rhcloud.com/tracker/PyDev) providing details on
your platform/eclipse version and a screenshot (you can upload it to
imgur).
Best Regards,
Fabio
weird, mine showed above....will test it later.

Loading...