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


Groups > comp.lang.python > #82116

Re: module import questions and question about pytest and module imports

Return-Path <samp4040@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.023
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'sys': 0.07; 'stating': 0.09; 'subject:module': 0.09; 'subject:question': 0.10; 'python': 0.11; "wouldn't": 0.14; '__init__.py': 0.16; 'imports': 0.16; 'pytest': 0.16; 'say.': 0.16; 'setuptools': 0.16; 'subject:import': 0.16; 'subject:questions': 0.16; 'sys.path': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'seems': 0.21; 'import': 0.22; 'saying': 0.22; 'directory.': 0.24; 'this:': 0.26; 'header :In-Reply-To:1': 0.27; 'idea': 0.28; 'am,': 0.29; 'dec': 0.30; 'relative': 0.30; 'statement': 0.30; 'message-id:@mail.gmail.com': 0.30; 'getting': 0.31; 'guess': 0.33; "can't": 0.35; 'received:google.com': 0.35; 'there': 0.35; 'module.': 0.36; 'thanks': 0.36; 'so,': 0.37; 'work?': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'little': 0.38; 'to:addr:python.org': 0.39; 'either': 0.39; 'dave': 0.60; 'most': 0.60; "you're": 0.61; 'back': 0.62; 'sam': 0.68; 'statement,': 0.68; 'bundling': 0.84; 'me!': 0.84; 'off,': 0.84; 'angel': 0.91; 'examine': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Mm9nKP0SkaigzlM1h1u3Zj+an5CAztcNZ36MnJ7VxT8=; b=z3xnMh0xXK/4LgWXlJ5C6NaTWTZdW6H7vsq5Sq3M3dXspRfu3D3cF5Ve6Jtr+POykL rNBrcA0Qju+bya0MdGDk7mmp9dexP/HsaEu6Lw4mQ/QDqWOaWioMrkuOIzEqz5uqyYMm ztAVnXqIvNZ1IH0tPM/27Flqca/cPLXMVa1lRt+ktAtkvfzJrQA1w11A2pOek2VLe4AD kKjCcIXliqnKEi1dWvDy/+IAEB5giIrQaJWJcQ70gWry7aNvk3HiTPlUlNGzUfQwwQA3 2/B1raaKfxQDBpp4c/HR4od/VEuwaX/qtnQyz/vE1Lsc2ZlIcZOalYoEuRb00mxSM2UB 3YTg==
MIME-Version 1.0
X-Received by 10.43.132.137 with SMTP id hu9mr22420952icc.27.1417971030185; Sun, 07 Dec 2014 08:50:30 -0800 (PST)
In-Reply-To <54847FAF.8040006@davea.name>
References <CAPti5iMacuhtNhGg_YkqdkW+X36R6bzRTo_RWn-KMq0CwczAOQ@mail.gmail.com> <54847FAF.8040006@davea.name>
Date Sun, 7 Dec 2014 11:50:30 -0500
Subject Re: module import questions and question about pytest and module imports
From sam pendleton <samp4040@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=UTF-8
X-Mailman-Approved-At Mon, 08 Dec 2014 10:27:03 +0100
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.16715.1418030824.18130.python-list@python.org> (permalink)
Lines 38
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1418030824 news.xs4all.nl 2900 [2001:888:2000:d::a6]:51652
X-Complaints-To abuse@xs4all.nl
Path csiph.com!usenet.pasdenom.info!bete-des-vosges.org!feed.ac-versailles.fr!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Xref csiph.com comp.lang.python:82116

Show key headers only | View raw


Thanks for getting back with me!

On Sun, Dec 7, 2014 at 11:26 AM, Dave Angel <davea@davea.name> wrote:
> 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.

Sorry Dave, I was saying that pytest is hung up there stating it can't
import that module.


> 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)

Having to put the garage package on the sys.path seems a little off,
why wouldn't relative imports work?

Do most people somehow put their packages in sys.path when bundling
their python packages up to be shared with setuptools or other python
package managers? If so, how?

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


Thread

Re: module import questions and question about pytest and module imports sam pendleton <samp4040@gmail.com> - 2014-12-07 11:50 -0500

csiph-web