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 =?UTF-8?Q?Sch=C3=B6=C3=B6n?= 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: References: <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 On 2013-06-29, Steven D'Aprano 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