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


Groups > comp.lang.python > #47718 > unrolled thread

Why doesn't nose see my plugin?

Started byRoy Smith <roy@panix.com>
First post2013-06-11 20:54 -0400
Last post2013-06-12 23:18 -0700
Articles 7 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  Why doesn't nose see my plugin? Roy Smith <roy@panix.com> - 2013-06-11 20:54 -0400
    Re: Why doesn't nose see my plugin? alex23 <wuwei23@gmail.com> - 2013-06-11 18:37 -0700
      Re: Why doesn't nose see my plugin? Roy Smith <roy@panix.com> - 2013-06-11 21:43 -0400
        Re: Why doesn't nose see my plugin? alex23 <wuwei23@gmail.com> - 2013-06-11 18:45 -0700
          Re: Why doesn't nose see my plugin? Roy Smith <roy@panix.com> - 2013-06-11 22:18 -0400
    Re: Why doesn't nose see my plugin? (FIXED) roy@panix.com (Roy Smith) - 2013-06-12 12:12 -0400
      Re: Why doesn't nose see my plugin? (FIXED) alex23 <wuwei23@gmail.com> - 2013-06-12 23:18 -0700

#47718 — Why doesn't nose see my plugin?

FromRoy Smith <roy@panix.com>
Date2013-06-11 20:54 -0400
SubjectWhy doesn't nose see my plugin?
Message-ID<roy-FDF804.20545811062013@news.panix.com>
I'm attempting to write a nose plugin.  Nosetests (version 1.3.0) is not 
seeing it.  I'm running python 2.7.3.  The plugin itself is:

mongo_reporter.py:
------------------------------------------------
import nose.plugins
import logging

log = logging.getLogger('nose.plugins.mongoreporter')

class MongoReporter(nose.plugins.Plugin):
    name = "Mongo Reporter"
    
    def options(self, parser, env):
        super(MongoReporter, self).options(parser, env=env)

    def configure(self, options, conf):
        super(MongoReporter, self).options(options, conf)

    def finalize(self, result):
        log.info("Hello from Mongo Reporter")
------------------------------------------------

I also have setup.py:

------------------------------------------------
#!/usr/bin/env python

from setuptools import setup, find_packages

setup(
    name = "Mongo Reporter",
    version = "0.0",
    entry_points = {
        'nose.plugins.1.10': ['mongoreporter = 
mongo_reporter.MongoReporter'],
        },
    )
------------------------------------------------

$ ./setup.py develop
running develop
running egg_info
writing Mongo_Reporter.egg-info/PKG-INFO
writing top-level names to Mongo_Reporter.egg-info/top_level.txt
writing dependency_links to Mongo_Reporter.egg-info/dependency_links.txt
writing entry points to Mongo_Reporter.egg-info/entry_points.txt
reading manifest file 'Mongo_Reporter.egg-info/SOURCES.txt'
writing manifest file 'Mongo_Reporter.egg-info/SOURCES.txt'
running build_ext
Creating 
/home/roy/deploy/current/python/lib/python2.7/site-packages/Mongo-Reporte
r.egg-link (link to .)
Mongo-Reporter 0.0 is already the active version in easy-install.pth

Installed /home/roy/deploy/current/code/testing/nose
Processing dependencies for Mongo-Reporter==0.0
Finished processing dependencies for Mongo-Reporter==0.0


$ nosetests --plugins
Plugin capture
Plugin failuredetail
Plugin xunit
Plugin deprecated
Plugin skip
Plugin multiprocess
Plugin logcapture
Plugin coverage
Plugin attributeselector
Plugin doctest
Plugin profile
Plugin id
Plugin allmodules
Plugin collect-only
Plugin isolation
Plugin pdb

I'm not really familiar with setuptools, so I don't know if I've got a 
"I'm doing something with nose" issue or a "I'm doing something wrong 
with setuptools" issue.

[toc] | [next] | [standalone]


#47723

Fromalex23 <wuwei23@gmail.com>
Date2013-06-11 18:37 -0700
Message-ID<69d4486b-d2ff-4830-b16e-f3f6ea73d494@kt20g2000pbb.googlegroups.com>
In reply to#47718
On Jun 12, 10:54 am, Roy Smith <r...@panix.com> wrote:
> I'm attempting to write a nose plugin.  Nosetests (version 1.3.0) is not
> seeing it.
>
> setup(

>     entry_points = {
>         'nose.plugins.1.10': ['mongoreporter =
> mongo_reporter.MongoReporter'],
>         },

Hey Roy,

I've never actually written a nose plugin so this is a wild stab in
the dark, but should the entry point be 'nose.plugins.1.3.0' in order
to reflect the version of nose?

[toc] | [prev] | [next] | [standalone]


#47724

FromRoy Smith <roy@panix.com>
Date2013-06-11 21:43 -0400
Message-ID<roy-1C4A94.21430511062013@news.panix.com>
In reply to#47723
In article 
<69d4486b-d2ff-4830-b16e-f3f6ea73d494@kt20g2000pbb.googlegroups.com>,
 alex23 <wuwei23@gmail.com> wrote:

> On Jun 12, 10:54 am, Roy Smith <r...@panix.com> wrote:
> > I'm attempting to write a nose plugin.  Nosetests (version 1.3.0) is not
> > seeing it.
> >
> > setup(
> 
> >     entry_points = {
> >         'nose.plugins.1.10': ['mongoreporter =
> > mongo_reporter.MongoReporter'],
> >         },
> 
> Hey Roy,
> 
> I've never actually written a nose plugin so this is a wild stab in
> the dark, but should the entry point be 'nose.plugins.1.3.0' in order
> to reflect the version of nose?

I took the above directly from the example in 
https://nose.readthedocs.org/en/latest/plugins/writing.html

Just to see what would happen, I tried changing it to:

    entry_points = {
        'nose.plugins.1.3.0': ['mongoreporter = 
testing.nose.mongo_reporter.MongoReporter'],
        },

didn't appear to make any difference.  I'm still trying to wrap my head 
completely around setuptools.  I haven't fully figured out how the entry 
points stuff works.

[toc] | [prev] | [next] | [standalone]


#47725

Fromalex23 <wuwei23@gmail.com>
Date2013-06-11 18:45 -0700
Message-ID<0d704515-46c9-486a-993c-ff5add3c926d@rh15g2000pbb.googlegroups.com>
In reply to#47724
On Jun 12, 11:43 am, Roy Smith <r...@panix.com> wrote:
> Just to see what would happen, I tried changing it to:
>
>     entry_points = {
>         'nose.plugins.1.3.0': ['mongoreporter =
> testing.nose.mongo_reporter.MongoReporter'],
>         },
>
> didn't appear to make any difference.

Yeah, reading some more it looks like it's referring to the version of
the plugin API and not of nose itself, sorry for the mislead.

[toc] | [prev] | [next] | [standalone]


#47733

FromRoy Smith <roy@panix.com>
Date2013-06-11 22:18 -0400
Message-ID<roy-84E830.22184311062013@news.panix.com>
In reply to#47725
In article 
<0d704515-46c9-486a-993c-ff5add3c926d@rh15g2000pbb.googlegroups.com>,
 alex23 <wuwei23@gmail.com> wrote:

> On Jun 12, 11:43 am, Roy Smith <r...@panix.com> wrote:
> > Just to see what would happen, I tried changing it to:
> >
> >     entry_points = {
> >         'nose.plugins.1.3.0': ['mongoreporter =
> > testing.nose.mongo_reporter.MongoReporter'],
> >         },
> >
> > didn't appear to make any difference.
> 
> Yeah, reading some more it looks like it's referring to the version of
> the plugin API and not of nose itself, sorry for the mislead.

Thanks anyway.

In the meantime, I've worked around the problem by puttingL

if __name__ == '__main__':
    nose.main(addplugins=[MongoReporter()])

in my test file, so at least the setuptools issue isn't a blocker for 
continuing to work on the plugin.

[toc] | [prev] | [next] | [standalone]


#47812 — Re: Why doesn't nose see my plugin? (FIXED)

Fromroy@panix.com (Roy Smith)
Date2013-06-12 12:12 -0400
SubjectRe: Why doesn't nose see my plugin? (FIXED)
Message-ID<kpa6m9$38p$1@panix2.panix.com>
In reply to#47718
In article <roy-FDF804.20545811062013@news.panix.com>,
Roy Smith  <roy@panix.com> wrote:

>setup(
>    name = "Mongo Reporter",
>    version = "0.0",
>    entry_points = {
>        'nose.plugins.1.10': ['mongoreporter = mongo_reporter.MongoReporter'],
>        },
>    )

The problem turned out to be the syntax of the entry_point
declaration.  It should have been "mongo_reporter:MongoReporter"
(colon, not dot, delimiting the module from the class).

Still strugging to get my head fully around setuptools :-)

[toc] | [prev] | [next] | [standalone]


#47903 — Re: Why doesn't nose see my plugin? (FIXED)

Fromalex23 <wuwei23@gmail.com>
Date2013-06-12 23:18 -0700
SubjectRe: Why doesn't nose see my plugin? (FIXED)
Message-ID<9ff0ea18-284b-4e0c-acab-9988c2bdb503@li6g2000pbb.googlegroups.com>
In reply to#47812
On Jun 13, 2:12 am, r...@panix.com (Roy Smith) wrote:
> Still strugging to get my head fully around setuptools :-)

We should start a club! :D

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web