Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #49464

Re: Unittest fails to import module

From Martin Schöön <martin.schoon@gmail.com>
Newsgroups comp.lang.python
Subject Re: Unittest fails to import module
Date 2013-06-29 21:19 +0000
Organization @ Home
Message-ID <b391b9Fl0dpU1@mid.individual.net> (permalink)
References <b38pvbFjlv9U1@mid.individual.net> <51cf3500$0$29999$c3e8da3$5496439d@news.astraweb.com>

Show all headers | View raw


On 2013-06-29, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote:
> On Sat, 29 Jun 2013 19:13:47 +0000, Martin Schöön wrote:
>
>> $PYTHONPATH points at both the code and the test directories.
>> 
>> When I run blablabla_test.py it fails to import blablabla.py
>
> What error message do you get?
>
>  
>> I have messed around for oven an hour and get nowhere. I have done
>> unittesting like this with success in the past and I have revisited one
>> of those projects and it still works there.
> [...]
>> Any leads?
>
> The first step is to confirm that your path is setup correctly. At the 
> very top of blablabla_test, put this code:
>
> import os, sys
> print(os.getenv('PYTHONPATH'))
> print(sys.path)
>
Yes, right, I had not managed to make my change to PYTHONPATH stick.
I said the explanation would be trivial, didn't I?

Thanks for the quick replies. I am back in business now.

No, neither English nor Python are native languages of mine but I
enjoy (ab)using both :-)

/Martin

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Unittest fails to import module Martin Schöön <martin.schoon@gmail.com> - 2013-06-29 19:13 +0000
  Re: Unittest fails to import module Roy Smith <roy@panix.com> - 2013-06-29 15:25 -0400
  Re: Unittest fails to import module Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-29 19:26 +0000
    Re: Unittest fails to import module Martin Schöön <martin.schoon@gmail.com> - 2013-06-29 21:19 +0000

csiph-web