error: package directory 'test_timer_plugin' does not exist

2,015 views
Skip to first unread message

kahmed

unread,
Apr 5, 2011, 6:53:28 PM4/5/11
to nose-users
I am trying to register a plugin, but getting an error message

$ sudo python setup.py install

running install
install_dir /usr/local/lib/python2.6/dist-packages/
Checking .pth file support in /usr/local/lib/python2.6/dist-packages/
/usr/bin/python -E -c pass
TEST PASSED: /usr/local/lib/python2.6/dist-packages/ appears to
support .pth files
running bdist_egg
running egg_info
creating test_timer_plugin.egg-info
writing test_timer_plugin.egg-info/PKG-INFO
writing top-level names to test_timer_plugin.egg-info/top_level.txt
writing dependency_links to test_timer_plugin.egg-info/
dependency_links.txt
writing entry points to test_timer_plugin.egg-info/entry_points.txt
writing manifest file 'test_timer_plugin.egg-info/SOURCES.txt'
error: package directory 'test_timer_plugin' does not exist
kahmed@jenkins-server-1:~/workspace/PR-TEST-RUNNER/nose/plugins$ more
setup.py
from setuptools import setup

setup(
name='test_timer_plugin', version='1.0',
packages = ['test_timer_plugin'],
entry_points = {
'nose.plugins': [
'testtimer = test_timer_plugin:testtimer',
]
},
)

Kumar McMillan

unread,
Apr 6, 2011, 2:28:16 PM4/6/11
to nose-...@googlegroups.com
On Tue, Apr 5, 2011 at 5:53 PM, kahmed <kamal22...@gmail.com> wrote:
> from setuptools import setup
>
> setup(
>    name='test_timer_plugin', version='1.0',
>    packages = ['test_timer_plugin'],
>    entry_points = {
>        'nose.plugins': [
>            'testtimer = test_timer_plugin:testtimer',
>            ]
>        },
> )

Hi Kahmed,
This is easier:

from setuptools import setup, find_packages

setup(
name='test_timer_plugin',
version='1.0',

packages=find_packages(),


entry_points = {
'nose.plugins': [
'testtimer = test_timer_plugin:testtimer',
]
},
)


>
> --
> You received this message because you are subscribed to the Google Groups "nose-users" group.
> To post to this group, send email to nose-...@googlegroups.com.
> To unsubscribe from this group, send email to nose-users+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/nose-users?hl=en.
>
>

Kamal Ahmed

unread,
Apr 6, 2011, 3:17:59 PM4/6/11
to nose-...@googlegroups.com
Hi Kumar,

Thank i tried this setup.py


 sudo python setup.py install
running install
install_dir /usr/local/lib/python2.6/dist-packages/
Checking .pth file support in /usr/local/lib/python2.6/dist-packages/
/usr/bin/python -E -c pass
TEST PASSED: /usr/local/lib/python2.6/dist-packages/ appears to support .pth files
running bdist_egg
running egg_info
creating test_timer_plugin.egg-info
writing test_timer_plugin.egg-info/PKG-INFO
writing top-level names to test_timer_plugin.egg-info/top_level.txt
writing dependency_links to test_timer_plugin.egg-info/dependency_links.txt
writing entry points to test_timer_plugin.egg-info/entry_points.txt
writing manifest file 'test_timer_plugin.egg-info/SOURCES.txt'
reading manifest file 'test_timer_plugin.egg-info/SOURCES.txt'
writing manifest file 'test_timer_plugin.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
warning: install_lib: 'build/lib.linux-x86_64-2.6' does not exist -- no Python modules to install
creating build
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying test_timer_plugin.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying test_timer_plugin.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying test_timer_plugin.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying test_timer_plugin.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying test_timer_plugin.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/test_timer_plugin-1.0-py2.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing test_timer_plugin-1.0-py2.6.egg
creating /usr/local/lib/python2.6/dist-packages/test_timer_plugin-1.0-py2.6.egg
Extracting test_timer_plugin-1.0-py2.6.egg to /usr/local/lib/python2.6/dist-packages
Adding test-timer-plugin 1.0 to easy-install.pth file

Installed /usr/local/lib/python2.6/dist-packages/test_timer_plugin-1.0-py2.6.egg
Processing dependencies for test-timer-plugin==1.0
Finished processing dependencies for test-timer-plugin==1.0

but now when i try to run, i get

nosetests -w tests/ -v --with-id  --with-xunit --trim-errors --collect-only --with-test-timer
/usr/local/lib/python2.6/dist-packages/nose-1.0.0-py2.6.egg/nose/plugins/manager.py:383: RuntimeWarning: Unable to load plugin testtimer = test_timer_plugin:testtimer: No module named test_timer_plugin
  RuntimeWarning)
Usage: nosetests [options]

nosetests: error: no such option: --with-test-timer


Does this have to do with the fact that the "name" in the class TestTimer is    name = 'test-timer'

class TestTimer(Plugin):
    """This plugin provides test timings
    """
    enabled = True
    name = 'test-timer'
    score = 1



Thanks,
-Kamal.

Kamal Ahmed

unread,
Apr 6, 2011, 5:12:54 PM4/6/11
to nose-...@googlegroups.com
ok here is another try:

keeping it VERY Simple

setup(
    name='testtimer',
    version='1.0',
    py_modules=['testtimer'],
    )



sudo python setup.py install
running install
install_dir /usr/local/lib/python2.6/dist-packages/
Checking .pth file support in /usr/local/lib/python2.6/dist-packages/
/usr/bin/python -E -c pass
TEST PASSED: /usr/local/lib/python2.6/dist-packages/ appears to support .pth files
running bdist_egg
running egg_info
creating testtimer.egg-info
writing testtimer.egg-info/PKG-INFO
writing top-level names to testtimer.egg-info/top_level.txt
writing dependency_links to testtimer.egg-info/dependency_links.txt
writing manifest file 'testtimer.egg-info/SOURCES.txt'
file testtimer.py (for module testtimer) not found
reading manifest file 'testtimer.egg-info/SOURCES.txt'
writing manifest file 'testtimer.egg-info/SOURCES.txt'

installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
file testtimer.py (for module testtimer) not found
file testtimer.py (for module testtimer) not found

warning: install_lib: 'build/lib.linux-x86_64-2.6' does not exist -- no Python modules to install
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying testtimer.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying testtimer.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying testtimer.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying testtimer.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO

zip_safe flag not set; analyzing archive contents...
creating 'dist/testtimer-1.0-py2.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it

removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing testtimer-1.0-py2.6.egg
creating /usr/local/lib/python2.6/dist-packages/testtimer-1.0-py2.6.egg
Extracting testtimer-1.0-py2.6.egg to /usr/local/lib/python2.6/dist-packages
Adding testtimer 1.0 to easy-install.pth file

Installed /usr/local/lib/python2.6/dist-packages/testtimer-1.0-py2.6.egg
Processing dependencies for testtimer==1.0
Finished processing dependencies for testtimer==1.0

still not able to register the plugin

nosetests --with-test-timer

/usr/local/lib/python2.6/dist-packages/nose-1.0.0-py2.6.egg/nose/plugins/manager.py:383: RuntimeWarning: Unable to load plugin testtimer = test_timer_plugin:testtimer: No module named test_timer_plugin
  RuntimeWarning)
Usage: nosetests [options]

nosetests: error: no such option: --with-test-timer


Now even though , i changed the name to testtimer, it has retained the name test_timer_plugin, somewhere else

Thanks,
-Kamal.

Kumar McMillan

unread,
Apr 6, 2011, 6:10:11 PM4/6/11
to nose-...@googlegroups.com
Hi Kamal.

To understand how to install modules with a setup.py file you may want
to read up on http://docs.python.org/distutils/setupscript.html

As for activating the Nose plugin...

On Wed, Apr 6, 2011 at 4:12 PM, Kamal Ahmed <kamal22...@gmail.com> wrote:
> RuntimeWarning: Unable to load plugin testtimer =
> test_timer_plugin:testtimer: No module named test_timer_plugin

On the left side of the colon is a module and on the right side is a
plugin subclass. On the command line you can test it like this to
make sure it works:

>>> from test_timer_plugin import testtimer

You will need to adjust the names when the name of the module file
changes in your setup.py file.

-Kumar

Kamal Ahmed

unread,
Apr 6, 2011, 7:13:37 PM4/6/11
to nose-...@googlegroups.com
sometimes i think Python is checking my common sense.
-K

works: as

kahmed@jenkins-server-1:~/workspace/PR-TEST-RUNNER/nose/plugins$ sudo python setup.py install

running install
install_dir /usr/local/lib/python2.6/dist-packages/
Checking .pth file support in /usr/local/lib/python2.6/dist-packages/
/usr/bin/python -E -c pass
TEST PASSED: /usr/local/lib/python2.6/dist-packages/ appears to support .pth files
running bdist_egg
running egg_info
creating testtimer.egg-info
writing testtimer.egg-info/PKG-INFO
writing top-level names to testtimer.egg-info/top_level.txt
writing dependency_links to testtimer.egg-info/dependency_links.txt
writing manifest file 'testtimer.egg-info/SOURCES.txt'
reading manifest file 'testtimer.egg-info/SOURCES.txt'
writing manifest file 'testtimer.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/lib.linux-x86_64-2.6
copying testtimer.py -> build/lib.linux-x86_64-2.6
creating build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.6/testtimer.py -> build/bdist.linux-x86_64/egg
byte-compiling build/bdist.linux-x86_64/egg/testtimer.py to testtimer.pyc

creating build/bdist.linux-x86_64/egg/EGG-INFO
copying testtimer.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying testtimer.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying testtimer.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying testtimer.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO

zip_safe flag not set; analyzing archive contents...
creating 'dist/testtimer-1.1-py2.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it

removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing testtimer-1.1-py2.6.egg
creating /usr/local/lib/python2.6/dist-packages/testtimer-1.1-py2.6.egg
Extracting testtimer-1.1-py2.6.egg to /usr/local/lib/python2.6/dist-packages
Removing testtimer 1.0 from easy-install.pth file
Adding testtimer 1.1 to easy-install.pth file

Installed /usr/local/lib/python2.6/dist-packages/testtimer-1.1-py2.6.egg
Processing dependencies for testtimer==1.1
Finished processing dependencies for testtimer==1.1
kahmed@jenkins-server-1:~/workspace/PR-TEST-RUNNER/nose/plugins$ python
Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import testtimer
>>> dir(testtimer)
['Plugin', '__builtins__', '__doc__', '__file__', '__name__', '__package__', 'nose', 'operator', 'testtimer', 'time']
>>>
>>> exit()
kahmed@jenkins-server-1:~/workspace/PR-TEST-RUNNER/nose/plugins$ more setup.py

from setuptools import setup
setup(
    name='testtimer',
    version='1.1',
    py_modules=['testtimer'],

    )
kahmed@jenkins-server-1:~/workspace/PR-TEST-RUNNER/nose/plugins$ ls testtimer.py
testtimer.py

i would expect dir(testtimer) to return class and methods but no it returns built-in attributes, i wonder how i can return methods to make sure that testtimer is indeed the module i just registered.

On to making setup.py a bit more elaborate :)

Thanks,
-Kamal. 

Kamal Ahmed

unread,
Apr 6, 2011, 7:31:32 PM4/6/11
to nose-...@googlegroups.com
Strange , even though i can import it from python prompt, it is still not installed

nosetests --with-test-timer

/usr/local/lib/python2.6/dist-packages/nose-1.0.0-py2.6.egg/nose/plugins/manager.py:383: RuntimeWarning: Unable to load plugin testtimer = test_timer_plugin:testtimer: No module named test_timer_plugin
  RuntimeWarning)
Usage: nosetests [options]

nosetests: error: no such option: --with-test-timer

-K

Kumar McMillan

unread,
Apr 6, 2011, 7:37:58 PM4/6/11
to nose-...@googlegroups.com
On Wed, Apr 6, 2011 at 6:31 PM, Kamal Ahmed <kamal22...@gmail.com> wrote:
> Strange , even though i can import it from python prompt, it is still not
> installed
>
> nosetests --with-test-timer
> /usr/local/lib/python2.6/dist-packages/nose-1.0.0-py2.6.egg/nose/plugins/manager.py:383:
> RuntimeWarning: Unable to load plugin testtimer =
> test_timer_plugin:testtimer: No module named test_timer_plugin
>   RuntimeWarning)

^^ still cannot import your module

I saw this in your shell:

>>> import testtimer
>>> dir(testtimer)

But that is not testing the path you are giving to Nose for Nose to
find your module: test_timer_plugin:testtimer

Kamal Ahmed

unread,
Apr 7, 2011, 10:31:44 AM4/7/11
to nose-...@googlegroups.com
Hi Kumar,

Thanks SO much for helping me out, and getting me to think in the right direction. Here is the configuration that worked.

more setup.py
import sys
try:
    import ez_setup
    ez_setup.use_setuptools()
except ImportError:
    pass


from setuptools import setup

setup(
    name='Test Timer plugin',
    version='0.1',
    author='Sam Hocevar ',
    author_email = 's...@hocevar.net',
    description = 'times every test plugin',
    license = 'GNU',
    py_modules = ['timetestplug'],
    entry_points = {
        'nose.plugins.0.10': [
            'timetests = timetestplug:TestTimer'
            ]
        }

    )


plus the actual plugin (to see HOW names are related between the source and setup.py)

 more timetestplug.py
"""This plugin provides test timings to identify which tests might be
taking the most. From this information, it might be useful to couple
individual tests nose's `--with-profile` option to profile problematic
tests.
This plugin is heavily influenced by nose's `xunit` plugin.
Add this command to the way you execute nose::
    --with-test-timer
"""

import operator
from time import time

import nose
from nose.plugins.base import Plugin



class TestTimer(Plugin):
    """This plugin provides test timings

    """

    name = 'test-timer'
    score = 1

-Kamal.
Reply all
Reply to author
Forward
0 new messages