From c13d750f34df98767d0089352469c4bb5f0ea7b3 Mon Sep 17 00:00:00 2001 From: Dominic Davis-Foster Date: Wed, 13 Mar 2024 10:25:39 +0000 Subject: [PATCH] Set placeholder environment variables for importcheck --- repo_helper.yml | 3 +++ repo_helper_bot/constants.py | 3 ++- tox.ini | 25 ++++++++++++++----------- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/repo_helper.yml b/repo_helper.yml index ce3a7b1..37d8b9b 100644 --- a/repo_helper.yml +++ b/repo_helper.yml @@ -42,3 +42,6 @@ mypy_plugins: pre_commit_exclude: "^requirements.txt$" mypy_version: "1.7.1" + +tox_unmanaged: + - testenv diff --git a/repo_helper_bot/constants.py b/repo_helper_bot/constants.py index df5c5f7..89fe213 100644 --- a/repo_helper_bot/constants.py +++ b/repo_helper_bot/constants.py @@ -63,7 +63,8 @@ app_id=GITHUBAPP_ID, ) -context_switcher.login_as_app() +if not os.environ.get("RH_BOT_IMPORTCHECK", 0): + context_switcher.login_as_app() def https_redirect() -> Optional["Response"]: diff --git a/tox.ini b/tox.ini index 196192e..064db0c 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,6 @@ # You may add new sections, but any changes made to the following sections will be lost: # * tox # * envlists -# * testenv # * testenv:.package # * testenv:py313-dev # * testenv:py312-dev @@ -31,16 +30,6 @@ requires = test = py38, py39, py310, py311, py312 qa = mypy, lint -[testenv] -setenv = - PYTHONDEVMODE=1 - PIP_DISABLE_PIP_VERSION_CHECK=1 - SETUPTOOLS_USE_DISTUTILS=stdlib -deps = importcheck>=0.1.0 -commands = - python --version - python -m importcheck {posargs:--show} - [testenv:.package] setenv = PYTHONDEVMODE=1 @@ -153,6 +142,20 @@ ignore = W002 toplevel = repo_helper_bot package = repo_helper_bot +[testenv] +setenv = + PYTHONDEVMODE=1 + PIP_DISABLE_PIP_VERSION_CHECK=1 + SETUPTOOLS_USE_DISTUTILS=stdlib + GITHUBAPP_ID=1234 + GITHUBAPP_SECRET=abc123 + GITHUBAPP_KEY=ABCDEFG + RH_BOT_IMPORTCHECK=1 +deps = importcheck>=0.1.0 +commands = + python --version + python -m importcheck {posargs:--show} + [coverage:run] plugins = coverage_pyver_pragma