From 5285471636e5086d8847c8acb6d26bb7ec06fbd2 Mon Sep 17 00:00:00 2001 From: Cian Hughes Date: Tue, 29 Apr 2025 14:33:17 +0100 Subject: [PATCH] Switched from "run-tests.sh" script to package manager scripts --- pyproject.toml | 5 +++++ run-tests.sh | 23 ----------------------- scripts/test.py | 19 +++++++++++++++++++ scripts/test_docs.py | 17 +++++++++++++++++ 4 files changed, 41 insertions(+), 23 deletions(-) delete mode 100755 run-tests.sh create mode 100644 scripts/test.py create mode 100644 scripts/test_docs.py diff --git a/pyproject.toml b/pyproject.toml index dee00bb..4569053 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,11 @@ invenio-config-iform = { path = "wheel/invenio_config_iform-0.13.1-py3-none-any. Homepage = "https://github.com/Cian-H/invenio-theme-iform" Issues = "https://github.com/Cian-H/invenio-theme-iform/issues" +[project.scripts] +test-docs = "scripts.test_docs:main" +test-code = "pytest:console_main" +test = "scripts.test:main" + [dependency-groups] tests = [ "invenio-app>=1.3.4,<2.0.0", diff --git a/run-tests.sh b/run-tests.sh deleted file mode 100755 index 32b91d5..0000000 --- a/run-tests.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash -# -*- coding: utf-8 -*- -# -# Copyright (C) 2019-2020 CERN. -# Copyright (C) 2019-2020 Northwestern University. -# Copyright (C) 2020-2021 Graz University of Technology. -# -# invenio-theme-iform is free software; you can redistribute it and/or -# modify it under the terms of the MIT License; see LICENSE file for more -# details. - - -# Quit on errors -set -o errexit - -# Quit on unbound symbols -set -o nounset - -python -m sphinx.cmd.build -qnN docs docs/_build/html -python -m pytest -tests_exit_code=$? -python -m sphinx.cmd.build -qnN -b doctest docs docs/_build/doctest -exit "$tests_exit_code" diff --git a/scripts/test.py b/scripts/test.py new file mode 100644 index 0000000..6ee80cf --- /dev/null +++ b/scripts/test.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2025 I-Form Advanced Manufacturing Research Centre. +# +# invenio-config-iform is free software; you can redistribute it and/or +# modify it under the terms of the MIT License; see LICENSE file for more +# details. + +"""Run all tests for this module consecutively.""" + +import pytest + +from . import test_docs + + +def main() -> None: + """Run tests for this module.""" + test_docs.main() + pytest.console_main() diff --git a/scripts/test_docs.py b/scripts/test_docs.py new file mode 100644 index 0000000..e06459c --- /dev/null +++ b/scripts/test_docs.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2025 I-Form Advanced Manufacturing Research Centre. +# +# invenio-config-iform is free software; you can redistribute it and/or +# modify it under the terms of the MIT License; see LICENSE file for more +# details. + +"""A script for testing sphinx documentation building.""" + +from sphinx.cmd.build import main as build_docs + + +def main() -> None: + """Attempt to build documentation.""" + build_docs(["-nN", "docs", "docs/_build/html"]) + build_docs(["-nN", "-b", "doctest", "docs", "docs/_build/doctest"])