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


Groups > comp.lang.python > #19135

Re: importing and nose

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!newsfeed.x-privat.org!news2.euro.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <andrea.crotti.0@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.093
X-Spam-Evidence '*H*': 0.81; '*S*': 0.00; 'sys': 0.05; 'cc:addr :python-list': 0.15; 'received:74.125.82.44': 0.15; 'received :mail-ww0-f44.google.com': 0.15; 'then?': 0.16; 'wrote:': 0.16; 'cc:no real name:2**0': 0.21; 'maybe': 0.21; 'header:In-Reply- To:1': 0.22; 'cc:2**0': 0.25; 'seconds': 0.25; 'pm,': 0.26; 'function': 0.27; 'skip:[ 10': 0.27; 'import': 0.27; 'pass': 0.28; 'example': 0.28; 'forgot': 0.28; 'cc:addr:python.org': 0.29; 'skip:p 30': 0.29; '2005': 0.30; 'quite': 0.31; 'does': 0.32; 'message-id:@gmail.com': 0.33; 'header:User-Agent:1': 0.33; 'right,': 0.34; 'calling': 0.34; 'received:74.125.82': 0.34; 'skip:: 10': 0.36; 'but': 0.37; 'received:74.125': 0.37; 'received:google.com': 0.37; 'why': 0.39; 'subject:: ': 0.39; '1000': 0.62; 'you.': 0.64; 'believe': 0.65; 'works,': 0.68; 'profile': 0.73; '0.000': 0.84; '1001': 0.84; 'otten': 0.84; 'python2': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=gPW82058XWeOet3a4/3qKqxkVa3g14Iw0FhJmCnKf6M=; b=xO035vU3XA797sakN0UDNkiwTgCvRsB606zqEjm1VW0IAX7Q5PxUjUBhABAp/jKLaJ ZoCbjJwwU17t97tYne3lpyxPmXyGBv/Cf8Fo+mZ9frXj7Fjyo3C9H9ewzuAhVJwL0285 QAgzmM2kC5RDZk3exoaIA7kWeti+BOCuw2Ro8=
Date Thu, 19 Jan 2012 17:49:57 +0000
From Andrea Crotti <andrea.crotti.0@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111224 Thunderbird/9.0.1
MIME-Version 1.0
To Peter Otten <__peter__@web.de>
Subject Re: importing and nose
References <4F184EAF.5080603@gmail.com> <jf9kar$bon$1@dough.gmane.org>
In-Reply-To <jf9kar$bon$1@dough.gmane.org>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4869.1326995401.27778.python-list@python.org> (permalink)
Lines 51
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1326995401 news.xs4all.nl 6984 [2001:888:2000:d::a6]:44827
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19135

Show key headers only | View raw


On 01/19/2012 05:36 PM, Peter Otten wrote:
>
> I don't believe you.

Quite sure it does:

[andrea@precision test]$ cat simple.py
import profile
from os import path
import sys

prof_path = path.join(path.dirname(__file__), 'profiling')
sys.path.append(prof_path)
import x


profile.run('x.f1()')
[andrea@precision test]$ cat simple.py
import profile
from os import path
import sys

prof_path = path.join(path.dirname(__file__), 'profiling')
sys.path.append(prof_path)
import x


profile.run('x.f1()')
[andrea@precision test]$ python2 simple.py
          2005 function calls in 0.057 seconds

    Ordered by: standard name

    ncalls  tottime  percall  cumtime  percall filename:lineno(function)
      1001    0.007    0.000    0.007    0.000 :0(range)
         1    0.007    0.007    0.007    0.007 :0(setprofile)
         1    0.000    0.000    0.050    0.050 <string>:1(<module>)
      1000    0.037    0.000    0.043    0.000 b.py:1(f2)
         0    0.000             0.000          profile:0(profiler)
         1    0.000    0.000    0.057    0.057 profile:0(x.f1())
         1    0.007    0.007    0.050    0.050 x.py:4(f1)



But in general you're perfectly right, I forgot about this profile 
"issue", calling
profile.runctx('x.f1()', locals=locals(), globals=globals())
works, even if maybe I don't even need to pass so much, but the x location
would be enough..

Why does the simple example works then?

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


Thread

Re: importing and nose Andrea Crotti <andrea.crotti.0@gmail.com> - 2012-01-19 17:49 +0000

csiph-web