Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#213 closed defect (wontfix)

tests can't load dependent modules

Reported by: onlyjob Owned by: Antoine Martin
Priority: minor Milestone:
Component: Testing Keywords: patch
Cc:

Description

Many unit tests fail to load because they can't find their modules:

Traceback (most recent call last): 
  File "tests/window_xlib_test.py", line 8, in <module> 
    from winswitch.util.simple_logger import Logger 
ImportError: No module named winswitch.util.simple_logger 

Perhaps there is a more elegant way to fix that what I did in the attached patch, but it works for me.

Thanks.

Attachments (1)

tests.patch (2.1 KB) - added by onlyjob 7 years ago.
patch

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by onlyjob

Attachment: tests.patch added

patch

comment:1 Changed 7 years ago by Antoine Martin

Owner: changed from Antoine Martin to Antoine Martin
Status: newaccepted

Hmmm, I set PYTHONPATH when I run them, but you're right that they should work out of the box. Let me think of something... (I don't particularly like the patch approach)

comment:2 Changed 7 years ago by onlyjob

Patch must be horrible and ugly because I don't know python at all. :)

It is merely a dirty fix to the extent of my ignorance.

I'm sure you know how to make it better.

Perhaps I should try setting PYTHONPATH as you do...

Thank you.

Cheers,
Dmitry.

comment:3 Changed 7 years ago by onlyjob

Thanks for PYTHONPATH hint.

IMHO this bug can be closed by providing script to properly invoke tests that are reasonable to run after every build, as batch.

comment:4 Changed 7 years ago by Antoine Martin

Resolution: wontfix
Status: acceptedclosed
export PYTHONPATH=.
./tests/sound/sound_util_test.py
./tests/util/utmp_test.py
#etc

Sorry but there is nothing to fix in the code itself, just set PYTHONPATH.

comment:5 in reply to:  4 Changed 7 years ago by onlyjob

Many thanks - I already dropped the patch from packaging in favour of PYTHONPATH (can you believe, I didn't know about it).

Note: See TracTickets for help on using tickets.