Strange Source Assistant Behaviour

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Strange Source Assistant Behaviour

WingIDE - User mailing list
Hi,

I just created a new projects for which I plan to use py.test (first time for me), my current structure is:

project_dir\
project_dir\main.py
project_dir\main_package\
project_dir\main_package\__init__.py
project_dir\main_package\utils.py
project_dir\testing\
project_dir\testing\test_utils.py
project_dir\testing\__init__.py

Now, when I do “import main_package.utils” in main.py source assist does it’s job and identifies the module,
But when I do “import main_package.utils” from test_utils.py Source Assistant does not identify the module.

Python Console works fine, Test runner runs the tests.
It is just when importing main_package things from inside testing\ files that its broken.

I am with latest Wing IDE 6 on Windows 10 using Anaconda as the python distribution. Project settings are all defaults except for the test patterns which I put “test_*.py”

Any clues?

Marc

--
http://www.marcfargas.com - will be finished someday.

_________________________________________________
Wing IDE users list
http://wingware.com/lists/wingide
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange Source Assistant Behaviour

WingIDE - User mailing list
I suspect that you either need to add the project_dir to your python
path or set main.py as your main debug file.

Cheers,

John

On 1/18/17 7:27 AM, Marc Fargas via wingide-users wrote:

> Hi,
>
> I just created a new projects for which I plan to use py.test (first
> time for me), my current structure is:
>
> project_dir\
> project_dir\main.py
> project_dir\main_package\
> project_dir\main_package\__init__.py
> project_dir\main_package\utils.py
> project_dir\testing\
> project_dir\testing\test_utils.py
> project_dir\testing\__init__.py
>
> Now, when I do “import main_package.utils” in main.py source assist does
> it’s job and identifies the module,
> But when I do “import main_package.utils” from test_utils.py Source
> Assistant does not identify the module.
>
> Python Console works fine, Test runner runs the tests.
> It is just when importing main_package things from inside testing\ files
> that its broken.
>
> I am with latest Wing IDE 6 on Windows 10 using Anaconda as the python
> distribution. Project settings are all defaults except for the test
> patterns which I put “test_*.py”
>
> Any clues?
>
> Marc
>
> --
> http://www.marcfargas.com - will be finished someday.
>
>
> _________________________________________________
> Wing IDE users list
> http://wingware.com/lists/wingide
>

_________________________________________________
Wing IDE users list
http://wingware.com/lists/wingide
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strange Source Assistant Behaviour

WingIDE - User mailing list
I replied to John instead of using “reply all”, my bad sorry.
For the sake of the list archive and future reference:

After his message (which solved the issue) I asked for more background and he told me:
The reason that it's needed is Wing needs to know what your python path at runtime will be; it doesn't assume that every module or package in the project can be imported.  The directory of the main debug file is always added to the path (this is how the interpreter works) as well as any directory specified in the python path.

Thanks,
marc

On Wed, Jan 18, 2017 at 4:42 PM, Wing IDE Support <[hidden email]> wrote:
I suspect that you either need to add the project_dir to your python path or set main.py as your main debug file.

Cheers,

John


On 1/18/17 7:27 AM, Marc Fargas via wingide-users wrote:
Hi,

I just created a new projects for which I plan to use py.test (first
time for me), my current structure is:

project_dir\
project_dir\main.py
project_dir\main_package\
project_dir\main_package\__init__.py
project_dir\main_package\utils.py
project_dir\testing\
project_dir\testing\test_utils.py
project_dir\testing\__init__.py

Now, when I do “import main_package.utils” in main.py source assist does
it’s job and identifies the module,
But when I do “import main_package.utils” from test_utils.py Source
Assistant does not identify the module.

Python Console works fine, Test runner runs the tests.
It is just when importing main_package things from inside testing\ files
that its broken.

I am with latest Wing IDE 6 on Windows 10 using Anaconda as the python
distribution. Project settings are all defaults except for the test
patterns which I put “test_*.py”

Any clues?

Marc

--
http://www.marcfargas.com - will be finished someday.


_________________________________________________
Wing IDE users list
http://wingware.com/lists/wingide





--
http://www.marcfargas.com - will be finished someday.

_________________________________________________
Wing IDE users list
http://wingware.com/lists/wingide
Loading...