Page MenuHomePhabricator
Paste P8804

tox-wikimedia draft 1
ActivePublic

Authored by Legoktm on Jul 24 2019, 9:58 PM.
import pluggy
from pprint import pprint as print
from tox.config import DepConfig
hookimpl = pluggy.HookimplMarker("tox")
TOOLS = {
'pytest': {
'commands': ['pytest'],
'deps': ['pytest'],
},
'flake8': {
'commands': ['flake8'],
'deps': ['flake8'],
}
}
@hookimpl
def tox_addoption(parser):
"""Add a command line option for later use"""
pass
@hookimpl
def tox_configure(config):
"""Access your option during configuration"""
# print(config.envconfigs)
for envname, config in config.envconfigs.items():
for factor in config.factors:
try:
fconfig = TOOLS[factor]
except KeyError:
continue
# print(config.deps)
config.deps.extend([DepConfig(dep) for dep in fconfig['deps']])
if not config.commands:
config.commands.append(fconfig['commands'])
# print(config.factors)
# print(config.deps)
# print(config.commands)
@hookimpl
def tox_runtest_post(venv):
pass

Event Timeline

Legoktm created this paste.Jul 24 2019, 9:58 PM