From e3f939d5fc4898c7d037acb161db7c8f719d3344 Mon Sep 17 00:00:00 2001 From: Sam Arbid Date: Wed, 15 Jan 2025 11:39:43 +0100 Subject: [PATCH 1/3] deps: update pytest-black and pytest-invenio versions --- setup.cfg | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index f99ea0d..0e4b604 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,6 +3,7 @@ # This file is part of Invenio. # Copyright (C) 2015-2018 CERN. # Copyright (C) 2022 Graz University of Technology. +# Copyright (C) 2025 KTH Royal Institute of Technology. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. @@ -31,8 +32,8 @@ install_requires = [options.extras_require] tests = - pytest-black>=0.3.0,<0.3.10 - pytest-invenio>=1.4.0 + pytest-black-ng>=0.4.0 + pytest-invenio>=2.1.0,<3.0.0 mock>=2.0.0 Sphinx>=1.8.0 From 4a95eff07b8296e02ec08ca1361cdf9747772dab Mon Sep 17 00:00:00 2001 From: Sam Arbid Date: Wed, 15 Jan 2025 11:40:31 +0100 Subject: [PATCH 2/3] style: autoformat with black --- tests/test_invenio_config.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_invenio_config.py b/tests/test_invenio_config.py index 313931e..4461648 100644 --- a/tests/test_invenio_config.py +++ b/tests/test_invenio_config.py @@ -177,9 +177,9 @@ def test_env(): os.environ["MYPREFIX_TESTVAR"] = "True" os.environ["MYPREFIX_JUSTASTRING"] = "This is just a string" - os.environ[ - "MYPREFIX_COMPLEX_DICT" - ] = "{'complex': {'python': 'dict'}, 'with': ['list', 'and', 1234]}" + os.environ["MYPREFIX_COMPLEX_DICT"] = ( + "{'complex': {'python': 'dict'}, 'with': ['list', 'and', 1234]}" + ) InvenioConfigEnvironment(app, prefix="MYPREFIX_") assert app.config.get("TESTVAR") is True assert app.config.get("JUSTASTRING") == "This is just a string" From 22e40a46587df31c742500290a4c52ef6cad5517 Mon Sep 17 00:00:00 2001 From: Sam Arbid Date: Wed, 15 Jan 2025 11:50:20 +0100 Subject: [PATCH 3/3] ci: use shared workflow for Python tests --- .github/workflows/tests.yml | 44 +++++-------------------------------- 1 file changed, 6 insertions(+), 38 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e099400..14c7fca 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,6 +3,7 @@ # This file is part of Invenio. # Copyright (C) 2020 CERN. # Copyright (C) 2022 Graz University of Technology. +# Copyright (C) 2025 KTH Royal Institute of Technology. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. @@ -11,9 +12,11 @@ name: CI on: push: - branches: master + branches: + - master pull_request: - branches: master + branches: + - master schedule: # * is a special character in YAML so you have to quote this string - cron: '0 3 * * 6' @@ -26,39 +29,4 @@ on: jobs: Tests: - runs-on: ubuntu-20.04 - strategy: - matrix: - python-version: [3.7, 3.8, 3.9] - requirements-level: [pypi] - env: - EXTRAS: tests - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Generate dependencies - run: | - pip install wheel requirements-builder - requirements-builder -e "$EXTRAS" ${{ matrix.requirements-file }} --level=${{ matrix.requirements-level }} setup.py > .${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt - - - name: Cache pip - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('.${{ matrix.requirements-level }}-${{ matrix.python-version }}-requirements.txt') }} - - - name: Install dependencies - run: | - pip install -r .${{matrix.requirements-level}}-${{ matrix.python-version }}-requirements.txt - pip install -e .[$EXTRAS] - pip freeze - - - name: Run tests - run: | - ./run-tests.sh + uses: inveniosoftware/workflows/.github/workflows/tests-python.yml@master