Python Unittest Configuration in 1.4.7

View: New views
3 Messages — Rating Filter:   Alert me  

Python Unittest Configuration in 1.4.7

by Kenneth Loafman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Under 1.4.6 of Pydev, all of my Python Unittest configurations worked.
Under 1.4.7, they do not.  I have not changed the setup, and the
unittests work from the commandline when running from the testing
directory.  The Unittest configuration is set up to have the working
directory at ${workspace_loc:duplicity-src/testing}, same as 1.4.6.

------
pydev debugger: starting
Finding files...
['/home/ken/workspace/duplicity-src/testing/finaltest.py'] ... done
Importing test modules ... Traceback (most recent call last):
  File
"/home/ken/eclipse3.4/plugins/org.python.pydev.debug_1.4.7.2843/pysrc/runfiles.py",
line 331, in __get_module_from_str
    mod = __import__(modname)
ImportError: No module named testing.finaltest
ERROR: Module: testing.finaltest could not be imported.
done.
------

It should be importing finaltest, not testing.finaltest.

It appears to me that Pydev is doing something different with the import
and the CWD.  Can you suggest a workaround for this?

...Thanks,
...Ken

------------------------------------------------------------------------------
_______________________________________________
Pydev-users mailing list
Pydev-users@...
https://lists.sourceforge.net/lists/listinfo/pydev-users

Re: Python Unittest Configuration in 1.4.7

by Fabio Zadrozny-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Yes, what was changed is that it tries to import the module in an
absolute way (before it always made relative imports, which would make
things fail in other ways -- I'll see if I can make it work in a way
that supports both scenarios).

You can fix it by:

- having __init__.py in your test modules (so that it becomes a valid
python package and can be properly imported)
- changing /org.python.pydev.debug/pysrc/runfiles.py at line 255 (in
the method __adjust_path): change sys.path.append(path_to_append) to
sys.path.insert(0, path_to_append)

Cheers,

Fabio

On Thu, Jul 23, 2009 at 10:32 AM, Kenneth Loafman<kenneth@...> wrote:

> Under 1.4.6 of Pydev, all of my Python Unittest configurations worked.
> Under 1.4.7, they do not.  I have not changed the setup, and the
> unittests work from the commandline when running from the testing
> directory.  The Unittest configuration is set up to have the working
> directory at ${workspace_loc:duplicity-src/testing}, same as 1.4.6.
>
> ------
> pydev debugger: starting
> Finding files...
> ['/home/ken/workspace/duplicity-src/testing/finaltest.py'] ... done
> Importing test modules ... Traceback (most recent call last):
>  File
> "/home/ken/eclipse3.4/plugins/org.python.pydev.debug_1.4.7.2843/pysrc/runfiles.py",
> line 331, in __get_module_from_str
>    mod = __import__(modname)
> ImportError: No module named testing.finaltest
> ERROR: Module: testing.finaltest could not be imported.
> done.
> ------
>
> It should be importing finaltest, not testing.finaltest.
>
> It appears to me that Pydev is doing something different with the import
> and the CWD.  Can you suggest a workaround for this?
>
> ...Thanks,
> ...Ken
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Pydev-users mailing list
> Pydev-users@...
> https://lists.sourceforge.net/lists/listinfo/pydev-users
>

------------------------------------------------------------------------------
_______________________________________________
Pydev-users mailing list
Pydev-users@...
https://lists.sourceforge.net/lists/listinfo/pydev-users

Re: Python Unittest Configuration in 1.4.7

by Kenneth Loafman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Fabio --- works like I think it should, IMNSHO.  ;-)

Good luck on solving this one.  Gonna be a hairy issue all over.

And thanks for the great software.  Its been a big help in development
and debugging.  I've been using Emacs for the last 25 or more years and
this is the package that got me into something better, and from an old
Emacs diehard, that's a compliment!

...Ken

Fabio Zadrozny wrote:

> Hi,
>
> Yes, what was changed is that it tries to import the module in an
> absolute way (before it always made relative imports, which would make
> things fail in other ways -- I'll see if I can make it work in a way
> that supports both scenarios).
>
> You can fix it by:
>
> - having __init__.py in your test modules (so that it becomes a valid
> python package and can be properly imported)
> - changing /org.python.pydev.debug/pysrc/runfiles.py at line 255 (in
> the method __adjust_path): change sys.path.append(path_to_append) to
> sys.path.insert(0, path_to_append)
>
> Cheers,
>
> Fabio
>
> On Thu, Jul 23, 2009 at 10:32 AM, Kenneth Loafman<kenneth@...> wrote:
>> Under 1.4.6 of Pydev, all of my Python Unittest configurations worked.
>> Under 1.4.7, they do not.  I have not changed the setup, and the
>> unittests work from the commandline when running from the testing
>> directory.  The Unittest configuration is set up to have the working
>> directory at ${workspace_loc:duplicity-src/testing}, same as 1.4.6.
>>
>> ------
>> pydev debugger: starting
>> Finding files...
>> ['/home/ken/workspace/duplicity-src/testing/finaltest.py'] ... done
>> Importing test modules ... Traceback (most recent call last):
>>  File
>> "/home/ken/eclipse3.4/plugins/org.python.pydev.debug_1.4.7.2843/pysrc/runfiles.py",
>> line 331, in __get_module_from_str
>>    mod = __import__(modname)
>> ImportError: No module named testing.finaltest
>> ERROR: Module: testing.finaltest could not be imported.
>> done.
>> ------
>>
>> It should be importing finaltest, not testing.finaltest.
>>
>> It appears to me that Pydev is doing something different with the import
>> and the CWD.  Can you suggest a workaround for this?
>>
>> ...Thanks,
>> ...Ken
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Pydev-users mailing list
>> Pydev-users@...
>> https://lists.sourceforge.net/lists/listinfo/pydev-users
>>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Pydev-users mailing list
> Pydev-users@...
> https://lists.sourceforge.net/lists/listinfo/pydev-users
>

------------------------------------------------------------------------------
_______________________________________________
Pydev-users mailing list
Pydev-users@...
https://lists.sourceforge.net/lists/listinfo/pydev-users