module import questions and question about pytest and module imports

Dave Angel davea at davea.name
Sun Dec 7 11:26:23 EST 2014


On 12/05/2014 11:50 PM, sam pendleton wrote:
> garage/
>      |- __init__.py
>      |- cars/
>          |- __init__.py
>          |- hummer.py
> tests/
>      |- test_cars.py
>
> at the top of test_cars.py, there is this:
>      from garage.cars import hummer
>
> pytest is on this import statement, so i guess it's incorrect.

No idea what that statement is trying to say.

>
> what should it be?

If you're going to import something, it either has to be on the 
sys.path, or in the current directory.  Is garage/ on your sys.path?

You can examine sys.path  by
    import sys
    print(sys.path)


-- 
DaveA



More information about the Python-list mailing list