Skip to content

Instantly share code, notes, and snippets.

@hpk42
Created May 8, 2015 11:39
Show Gist options
  • Save hpk42/7d265ebe89b7b71eb6a2 to your computer and use it in GitHub Desktop.
Save hpk42/7d265ebe89b7b71eb6a2 to your computer and use it in GitHub Desktop.
from tox import hookimpl
class GlobinterpreterPlugin:
@hookimpl
def tox_configure(self, config):
self.config = config
# postprocess config
@hookimpl
def tox_get_python_executable(self, name):
return path-to-pyhon-executable
@hookimpl
def tox_addoption(self, parser):
add command line options
@AvdN
Copy link

AvdN commented May 10, 2015

I tried this::

from tox import hookimpl

print ('GIP loading ....')

class GlobInterpreterPlugin:

    @hookimpl
    def tox_configure(self, config):
        print('......... postprocess config')
        self.config = config

    @hookimpl
    def tox_get_python_executable(self, name):
        print('......... path-to-pyhon-executable')
        return None

    @hookimpl
    def tox_addoption(self, parser):
        print('......... add command line options')


gip = GlobInterpreterPlugin()

But I only get the "GIP loading ...." message. When I make the methods into global functions (and dropping the self parameter) they all get called. Am I missing something obvious? I can move forward, so this is not urgent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment