How to use the tox.hookimpl function in tox

To help you get started, we’ve selected a few tox examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tox-dev / tox / tests / unit / test_venv.py View on Github external
        @tox.hookimpl
        def tox_runtest_pre(self):
            log.append("started")
github tox-dev / tox / tests / unit / test_venv.py View on Github external
        @tox.hookimpl
        def tox_testenv_install_deps(self, action, venv):
            assert isinstance(action, tox.session.Action)
            assert isinstance(venv, VirtualEnv)
            log.append(2)
github tox-dev / tox-venv / tests / test_venv.py View on Github external
        @tox.hookimpl
        def tox_runtest_post(self):
            log.append("finished")
github tox-dev / tox / src / tox / venv.py View on Github external
@tox.hookimpl
def tox_runtest(venv, redirect):
    venv.test(redirect=redirect)
    return True  # Return non-None to indicate plugin has completed
github tox-dev / tox-travis / src / tox_travis / hooks.py View on Github external
@tox.hookimpl
def tox_configure(config):
    """Check for the presence of the added options."""
    if 'TRAVIS' not in os.environ:
        return

    ini = config._cfg

    # envlist
    if 'TOXENV' not in os.environ and not config.option.env:
        envlist = detect_envlist(ini)
        undeclared = set(envlist) - set(config.envconfigs)
        if undeclared:
            print('Matching undeclared envs is deprecated. Be sure all the '
                  'envs that Tox should run are declared in the tox config.',
                  file=sys.stderr)
            autogen_envconfigs(config, undeclared)
github tox-dev / tox / src / tox / package.py View on Github external
@tox.hookimpl
def tox_package(session, venv):
    """Build an sdist at first call return that for all calls"""
    if not hasattr(session, "package"):
        session.package, session.dist = get_package(session)
    return session.package
github samstav / tox-pyenv / tox_pyenv.py View on Github external
@tox_hookimpl
def tox_get_python_executable(envconfig):
    """Return a python executable for the given python base name.

    The first plugin/hook which returns an executable path will determine it.

    ``envconfig`` is the testenv configuration which contains
    per-testenv configuration, notably the ``.envname`` and ``.basepython``
    setting.
    """
    try:
        # pylint: disable=no-member
        pyenv = (getattr(py.path.local.sysfind('pyenv'), 'strpath', 'pyenv')
                 or 'pyenv')
        cmd = [pyenv, 'which', envconfig.basepython]
        pipe = subprocess.Popen(
            cmd,
github tox-dev / tox-docker / tox_docker / __init__.py View on Github external
@hookimpl
def tox_addoption(parser):
    # necessary to allow the docker= directive in testenv sections
    parser.add_testenv_attribute(
        name="docker",
        type="line-list",
        help="Name of docker images, including tag, to start before the test run",
        default=[],
    )

    # command line flag to keep docker containers running
    parser.add_argument(
        "--docker-dont-stop",
        default=[],
        action="append",
        metavar="CONTAINER",
        help=(
github tonybaloney / retox / retox / exclude.py View on Github external
@hookimpl
def tox_addoption(parser):
    parser.add_argument(
        '--exclude', metavar='REGEX', default=None,
        help="Exclude files matching REGEX from being watched")
github tonybaloney / retox / retox / watch.py View on Github external
@hookimpl
def tox_addoption(parser):
    parser.add_argument(
        '-w', '--watch',
        action='append',
        help="Watch a folder for changes and rebuild when detected file changes/new files")