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


Groups > comp.lang.python > #49464

Re: Unittest fails to import module

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Martin Schöön <martin.schoon@gmail.com>
Newsgroups comp.lang.python
Subject Re: Unittest fails to import module
Date 29 Jun 2013 21:19:37 GMT
Organization @ Home
Lines 32
Message-ID <b391b9Fl0dpU1@mid.individual.net> (permalink)
References <b38pvbFjlv9U1@mid.individual.net> <51cf3500$0$29999$c3e8da3$5496439d@news.astraweb.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf8
Content-Transfer-Encoding 8bit
X-Trace individual.net QUIvo3AOgYwIEBnEbZcSJAxIdtfTw7JMI6Z0PhVOkp/z6GlQZ9
Cancel-Lock sha1:GCGeB9hGy1k0EYwYskSGPsOGQ50=
User-Agent slrn/pre1.0.0-18 (Linux)
Xref csiph.com comp.lang.python:49464

Show key headers only | 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