From 16ab9932629edafd9f4365db07080262c7c95a83 Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Wed, 2 Jun 2021 21:24:49 +0000 Subject: [PATCH] Bug 1713683 - Run `setup` function with `lintargs` including log and virtual env binary path. r=ahal This was oversight from Bug 1713178, which made black's `setup` function require them but didn't bump the test. Differential Revision: https://phabricator.services.mozilla.com/D116493 --- tools/lint/python/black.py | 5 ++--- tools/lint/test/conftest.py | 11 ++++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/lint/python/black.py b/tools/lint/python/black.py index a2b9c3048b41..3b85d788aca2 100644 --- a/tools/lint/python/black.py +++ b/tools/lint/python/black.py @@ -114,11 +114,10 @@ def setup(root, **lintargs): log = lintargs["log"] virtualenv_bin_path = lintargs.get("virtualenv_bin_path") # Using `which` searches multiple directories and handles `.exe` on Windows. - binary = mozpath.normsep( - which("black", path=(virtualenv_bin_path, default_bindir())) - ) + binary = which("black", path=(virtualenv_bin_path, default_bindir())) if binary and os.path.exists(binary): + binary = mozpath.normsep(binary) log.debug("Looking for black at {}".format(binary)) version = get_black_version(binary) versions = [ diff --git a/tools/lint/test/conftest.py b/tools/lint/test/conftest.py index ea99702f8576..7f27f598898b 100644 --- a/tools/lint/test/conftest.py +++ b/tools/lint/test/conftest.py @@ -93,8 +93,17 @@ def run_setup(config): if "setup" not in config: return + log = logging.LoggerAdapter( + logger, {"lintname": config.get("name"), "pid": os.getpid()} + ) + func = findobject(config["setup"]) - func(build.topsrcdir, virtualenv_manager=build.virtualenv_manager) + func( + build.topsrcdir, + virtualenv_manager=build.virtualenv_manager, + virtualenv_bin_path=build.virtualenv_manager.bin_path, + log=log, + ) @pytest.fixture