Created
September 6, 2019 15:43
-
-
Save jezdez/88f5e7c8608f2892d7dccc9778719238 to your computer and use it in GitHub Desktop.
Pytest plugin to disable some plugins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pytest_addoption(parser): | |
parser.addoption( | |
"--lean", | |
action="store_true", | |
default=False, | |
help="Set if this is running in a CI environment.", | |
) | |
def pytest_configure(config): | |
"""Hook implementation that unregisters optional plugins if "--ci" is specified.""" | |
lean = config.getoption("lean") | |
if not lean: | |
return | |
optional_plugins = ["_cov", "flake8", "isort"] | |
for optional_plugin in optional_plugins: | |
config.pluginmanager.unregister(name=optional_plugin) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment