Search code examples
pythonpytesttox

Python tox error "plugin already registered"


I'm trying to run a test-suite with tox for some work I'm doing on the jedi autocomplete library and I'm getting the following:

ValueError: Plugin already registered: /home/aldo/Documents/Projects/jedi/test/conftest.py=<module 'test.conftest' from '/home/aldo/Documents/Projects/jedi/test/conftest.py'>

The full output is available here:

https://gist.github.com/Astrac/5abdba7db62ac204325e

This is pytestdebug.log:

https://gist.github.com/Astrac/b5728dfeb22c0d2fb0f5

I tried running tox using pip in my main environment and running it within a clean virtual environment obtaining the same result. I also tried running py.test directly (from both my main environment and the virtual environment) but the result was the same.

On the other hand I know it works since I can see it running on travis:

https://travis-ci.org/davidhalter/jedi/jobs/5765531

Any help will be very appreciated, thank you!


Solution

  • I was getting this error message too. This is the first time I've tried making a setup.py or using tox so I was trying to copy examples I'd seen of other people's setup.py, since the official docs weren't very illuminating to me on this topic.

    My broken setup.py looked like this:

    from setuptools import setup, find_packages
    
    setup(
        name='foobarbaz',
        version='1.0',
        author="donald duck",
        author_email="foo@bar.baz.quux",
        package_dir={'': 'src'},
        packages=find_packages('src'),
        zip_safe=False,
    )
    

    There were one or two problematic keyword arguments, it turns out. I removed package_dir and packages, then the problem went away. So this is the working version:

    from setuptools import setup
    
    setup(
        name='foobarbaz',
        version='1.0',
        author="donald duck",
        author_email="foo@bar.baz.quux",
        zip_safe=False,
    )
    

    I don't know if your situation is similar or if you've resolved this yet, but I this is what worked for me.