From 9bde7e4680acc9a18ae660a99acf0030320594a6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 29 Sep 2023 21:35:50 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- integration-tests/plugins/simplest/tljh_simplest.py | 12 +++--------- integration-tests/test_simplest_plugin.py | 1 + tests/test_conda.py | 6 +++--- tljh/hooks.py | 1 - tljh/installer.py | 6 ++++-- 5 files changed, 11 insertions(+), 15 deletions(-) diff --git a/integration-tests/plugins/simplest/tljh_simplest.py b/integration-tests/plugins/simplest/tljh_simplest.py index d122acd..8b663b3 100644 --- a/integration-tests/plugins/simplest/tljh_simplest.py +++ b/integration-tests/plugins/simplest/tljh_simplest.py @@ -6,18 +6,12 @@ from tljh.hooks import hookimpl @hookimpl def tljh_extra_user_conda_packages(): - return [ - "hypothesis", - "csvtk", - "tqdm" - ] + return ["hypothesis", "csvtk", "tqdm"] + @hookimpl def tljh_extra_user_conda_channels(): - return [ - "conda-forge", - "bioconda" - ] + return ["conda-forge", "bioconda"] @hookimpl diff --git a/integration-tests/test_simplest_plugin.py b/integration-tests/test_simplest_plugin.py index 68bd859..055c9b1 100644 --- a/integration-tests/test_simplest_plugin.py +++ b/integration-tests/test_simplest_plugin.py @@ -33,6 +33,7 @@ def test_conda_packages(): subprocess.check_call([f"{USER_ENV_PREFIX}/bin/python3", "-c", "import hypothesis"]) subprocess.check_call([f"{USER_ENV_PREFIX}/bin/csvtk", "cat", "--help"]) + def test_tljh_extra_apt_packages(): assert os.path.exists("/usr/games/sl") diff --git a/tests/test_conda.py b/tests/test_conda.py index 575b831..de69f71 100644 --- a/tests/test_conda.py +++ b/tests/test_conda.py @@ -32,15 +32,15 @@ def test_ensure_packages(prefix): # Throws an error if this fails subprocess.check_call([os.path.join(prefix, "bin", "python"), "-c", "import numpy"]) - + def test_ensure_channel_packages(prefix): """ Test installing packages in conda environment """ - conda.ensure_conda_packages(prefix, ["csvtk"], channels=('conda-forge', 'bioconda')) + conda.ensure_conda_packages(prefix, ["csvtk"], channels=("conda-forge", "bioconda")) # Throws an error if this fails subprocess.check_call([os.path.join(prefix, "bin", "csvtk"), "cat", "--help"]) - + def test_ensure_pip_packages(prefix): """ diff --git a/tljh/hooks.py b/tljh/hooks.py index ce341fd..151134d 100644 --- a/tljh/hooks.py +++ b/tljh/hooks.py @@ -19,7 +19,6 @@ def tljh_extra_user_conda_channels(): """ Return a list of conda channels to be used during user environment installation. """ - pass @hookspec diff --git a/tljh/installer.py b/tljh/installer.py index f2b68c7..3e7c3e4 100644 --- a/tljh/installer.py +++ b/tljh/installer.py @@ -452,14 +452,16 @@ def run_plugin_actions(plugin_manager): conda_packages = list(set(itertools.chain(*hook.tljh_extra_user_conda_packages()))) conda_channels = list(itertools.chain(*hook.tljh_extra_user_conda_channels())) if len(conda_channels) == 0: - conda_channels = ('conda-forge',) + conda_channels = ("conda-forge",) if conda_packages: logger.info( "Installing {} user conda packages collected from plugins: {}".format( len(conda_packages), " ".join(conda_packages) ) ) - conda.ensure_conda_packages(USER_ENV_PREFIX, conda_packages, conda_channels=conda_channels) + conda.ensure_conda_packages( + USER_ENV_PREFIX, conda_packages, conda_channels=conda_channels + ) # Install pip packages user_pip_packages = list(set(itertools.chain(*hook.tljh_extra_user_pip_packages())))