diff --git a/.devcontainer/onCreate-conda.sh b/.devcontainer/onCreate-conda.sh index 380592bca5c..3226b78c51d 100755 --- a/.devcontainer/onCreate-conda.sh +++ b/.devcontainer/onCreate-conda.sh @@ -10,5 +10,4 @@ mamba env create -y --file environment-3.11-linux.yml || mamba env update -y --f conda init bash # Build sage -conda run -n sage-dev ./bootstrap -conda run -n sage-dev pip install --no-build-isolation -v -v -e ./src +conda run -n sage-dev pip install --no-build-isolation -v -v -e . diff --git a/.github/workflows/ci-meson.yml b/.github/workflows/ci-meson.yml index e777386fcfe..9a8a888eb62 100644 --- a/.github/workflows/ci-meson.yml +++ b/.github/workflows/ci-meson.yml @@ -69,7 +69,12 @@ jobs: export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" export CC="ccache $CC" export CXX="ccache $CXX" - pip install --no-build-isolation --config-settings=builddir=builddir . -v + # Use --no-deps and pip check below to verify that all necessary dependencies are installed via conda + pip install --no-build-isolation --no-deps --config-settings=builddir=builddir . -v + + - name: Verify dependencies + shell: bash -l {0} + run: pip check - name: Test shell: bash -l {0} @@ -77,3 +82,10 @@ jobs: # We don't install sage_setup, so don't try to test it rm -R ./src/sage_setup/ ./sage -t --all -p4 + + - name: Upload log + uses: actions/upload-artifact@v4.5.0 + if: failure() + with: + name: ${{ runner.os }}-meson-${{ matrix.python }}-log + path: builddir/meson-logs/ diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml index 538b44d1431..191fd1c8fad 100644 --- a/.github/workflows/dist.yml +++ b/.github/workflows/dist.yml @@ -119,10 +119,36 @@ jobs: with: name: dist path: dist - - uses: softprops/action-gh-release@v2 + - name: Create release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + latest_release_tag=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases \ + | jq -r 'sort_by(.created_at) | last(.[]).tag_name') + release_notes=$(curl -s \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/${{ github.repository }}/releases/generate-notes \ + -d "{ + \"tag_name\": \"${{ github.ref_name }}\", + \"previous_tag_name\": \"$latest_release_tag\" + }" | jq -r '.body') + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/${{ github.repository }}/releases \ + -d "{ + \"tag_name\": \"${{ github.ref_name }}\", + \"prerelease\": ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }}, + \"body\": \"$release_notes\" + }" + - name: Create release assets + uses: softprops/action-gh-release@v2 with: - generate_release_notes: true - prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }} files: | dist/* upstream/* diff --git a/.gitignore b/.gitignore index 323d81b557b..60ea5f51490 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,6 @@ /config.log /config.status /configure -/conftest* /confdefs.h /m4/sage_spkg_configures.m4 diff --git a/.vscode/settings.json b/.vscode/settings.json index c38aafb376d..b4a993ff7f3 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,9 +18,7 @@ }, "python.testing.pytestEnabled": true, "python.testing.pytestArgs": [ - "--rootdir=src/sage", - "-c=src/tox.ini", - "--doctest-modules" + "--doctest" ], "python.testing.unittestEnabled": false, "cSpell.words": [ diff --git a/CITATION.cff b/CITATION.cff index ae97bd81ee5..9cc52984028 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -4,8 +4,8 @@ title: SageMath abstract: SageMath is a free open-source mathematics software system. authors: - name: "The SageMath Developers" -version: 10.6.beta2 +version: 10.6.beta3 doi: 10.5281/zenodo.8042260 -date-released: 2024-12-22 +date-released: 2025-01-04 repository-code: "https://github.com/sagemath/sage" url: "https://www.sagemath.org/" diff --git a/README.md b/README.md index af91374fe19..f54d7ad34b6 100644 --- a/README.md +++ b/README.md @@ -679,7 +679,7 @@ information, patches, and build scripts are in the accompanying part of the Sage git repository.
- Copyright (C) 2005-2024 The Sage Development Team + Copyright (C) 2005-2025 The Sage Development Team
https://www.sagemath.org
diff --git a/VERSION.txt b/VERSION.txt
index a5da045ce22..7530113eb48 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1 +1 @@
-SageMath version 10.6.beta2, Release Date: 2024-12-22
+SageMath version 10.6.beta3, Release Date: 2025-01-04
diff --git a/build/pkgs/configure/checksums.ini b/build/pkgs/configure/checksums.ini
index e337163151d..1c872212d2e 100644
--- a/build/pkgs/configure/checksums.ini
+++ b/build/pkgs/configure/checksums.ini
@@ -1,3 +1,3 @@
tarball=configure-VERSION.tar.gz
-sha1=a03b8a505678cba0d652514d739bd32eb30bb925
-sha256=6525b44fea6b9d0238ca4790e8be5168e8d08c350787704a59ada9b6075a1f0f
+sha1=852d0d200a6a73aa5ddb9e00874cbe4a61c211e9
+sha256=c4b089d90850dfdf15b905f66e4f6a0d961b96eb0663d8603beaff1a9efb2cbe
diff --git a/build/pkgs/configure/package-version.txt b/build/pkgs/configure/package-version.txt
index 84217b4b61b..093cb148078 100644
--- a/build/pkgs/configure/package-version.txt
+++ b/build/pkgs/configure/package-version.txt
@@ -1 +1 @@
-291e54bf234b1753909f22a043e91a4a639693c1
+a2ba1f943f88775218c385efe55509c4548d1b44
diff --git a/build/pkgs/libtheora/SPKG.rst b/build/pkgs/libtheora/SPKG.rst
deleted file mode 100644
index 0c2c9e1c642..00000000000
--- a/build/pkgs/libtheora/SPKG.rst
+++ /dev/null
@@ -1,54 +0,0 @@
-libtheora: Library for the Theora video codec
-=============================================
-
-Description
------------
-
-libtheora is the official reference library for the Theora video codec.
-Theora is a free and open video compression format from the Xiph.org
-Foundation.
-
-Website: http://www.xiph.org/theora
-
-License
--------
-
-Copyright (c) 2002, Xiph.org Foundation
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-- Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
-- Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-- Neither the name of the Xiph.org Foundation nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-Upstream Contact
-----------------
-
-The Xiph.org mailing lists - see http://lists.xiph.org/mailman/listinfo
-
-Special Update/Build Instructions
----------------------------------
-
-- No changes went into src.
diff --git a/build/pkgs/libtheora/checksums.ini b/build/pkgs/libtheora/checksums.ini
deleted file mode 100644
index b940bb462c1..00000000000
--- a/build/pkgs/libtheora/checksums.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-tarball=libtheora-VERSION.tar.bz2
-sha1=8dcaa8e61cd86eb1244467c0b64b9ddac04ae262
-sha256=b6ae1ee2fa3d42ac489287d3ec34c5885730b1296f0801ae577a35193d3affbc
diff --git a/build/pkgs/libtheora/dependencies b/build/pkgs/libtheora/dependencies
deleted file mode 100644
index e62d879d3a4..00000000000
--- a/build/pkgs/libtheora/dependencies
+++ /dev/null
@@ -1,4 +0,0 @@
-libogg libpng
-
-----------
-All lines of this file are ignored except the first.
diff --git a/build/pkgs/libtheora/distros/conda.txt b/build/pkgs/libtheora/distros/conda.txt
deleted file mode 100644
index 944587f5d50..00000000000
--- a/build/pkgs/libtheora/distros/conda.txt
+++ /dev/null
@@ -1 +0,0 @@
-libtheora
diff --git a/build/pkgs/libtheora/distros/fedora.txt b/build/pkgs/libtheora/distros/fedora.txt
deleted file mode 100644
index 8043f5eea67..00000000000
--- a/build/pkgs/libtheora/distros/fedora.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-libtheora
-libtheora-devel
diff --git a/build/pkgs/libtheora/distros/homebrew.txt b/build/pkgs/libtheora/distros/homebrew.txt
deleted file mode 100644
index bddb694122d..00000000000
--- a/build/pkgs/libtheora/distros/homebrew.txt
+++ /dev/null
@@ -1 +0,0 @@
-theora
diff --git a/build/pkgs/libtheora/distros/macports.txt b/build/pkgs/libtheora/distros/macports.txt
deleted file mode 100644
index 944587f5d50..00000000000
--- a/build/pkgs/libtheora/distros/macports.txt
+++ /dev/null
@@ -1 +0,0 @@
-libtheora
diff --git a/build/pkgs/libtheora/distros/opensuse.txt b/build/pkgs/libtheora/distros/opensuse.txt
deleted file mode 100644
index 156db81fdea..00000000000
--- a/build/pkgs/libtheora/distros/opensuse.txt
+++ /dev/null
@@ -1 +0,0 @@
-pkgconfig(theora)
diff --git a/build/pkgs/libtheora/distros/repology.txt b/build/pkgs/libtheora/distros/repology.txt
deleted file mode 100644
index 944587f5d50..00000000000
--- a/build/pkgs/libtheora/distros/repology.txt
+++ /dev/null
@@ -1 +0,0 @@
-libtheora
diff --git a/build/pkgs/libtheora/distros/void.txt b/build/pkgs/libtheora/distros/void.txt
deleted file mode 100644
index cc4b4b3d8be..00000000000
--- a/build/pkgs/libtheora/distros/void.txt
+++ /dev/null
@@ -1 +0,0 @@
-libtheora-devel
diff --git a/build/pkgs/libtheora/package-version.txt b/build/pkgs/libtheora/package-version.txt
deleted file mode 100644
index 524cb55242b..00000000000
--- a/build/pkgs/libtheora/package-version.txt
+++ /dev/null
@@ -1 +0,0 @@
-1.1.1
diff --git a/build/pkgs/libtheora/spkg-install.in b/build/pkgs/libtheora/spkg-install.in
deleted file mode 100644
index b1f58b44681..00000000000
--- a/build/pkgs/libtheora/spkg-install.in
+++ /dev/null
@@ -1,24 +0,0 @@
-cd src
-
-./configure \
- --prefix="$SAGE_LOCAL" \
- --libdir="$SAGE_LOCAL/lib" \
- --with-ogg="$SAGE_LOCAL"
-if [ $? -ne 0 ]; then
- echo "Error configuring libtheora"
- exit 1
-fi
-
-$MAKE
-if [ $? -ne 0 ]; then
- echo "Error building libtheora"
- exit 1
-fi
-
-$MAKE -j1 install
-if [ $? -ne 0 ]; then
- echo "Error installing libtheora"
- exit 1
-fi
-
-cp examples/.libs/png2theora $SAGE_LOCAL/bin
diff --git a/build/pkgs/libtheora/type b/build/pkgs/libtheora/type
deleted file mode 100644
index 9839eb20815..00000000000
--- a/build/pkgs/libtheora/type
+++ /dev/null
@@ -1 +0,0 @@
-experimental
diff --git a/build/pkgs/sage_conf/version_requirements.txt b/build/pkgs/sage_conf/version_requirements.txt
index dac4c2ff0f5..89c6b32ac8e 100644
--- a/build/pkgs/sage_conf/version_requirements.txt
+++ b/build/pkgs/sage_conf/version_requirements.txt
@@ -1,2 +1,2 @@
# This file is updated on every release by the sage-update-version script
-sage-conf ~= 10.6b2
+sage-conf ~= 10.6b3
diff --git a/build/pkgs/sage_docbuild/version_requirements.txt b/build/pkgs/sage_docbuild/version_requirements.txt
index 1042c4d84b3..0db09dcea0c 100644
--- a/build/pkgs/sage_docbuild/version_requirements.txt
+++ b/build/pkgs/sage_docbuild/version_requirements.txt
@@ -1,2 +1,2 @@
# This file is updated on every release by the sage-update-version script
-sage-docbuild ~= 10.6b2
+sage-docbuild ~= 10.6b3
diff --git a/build/pkgs/sage_setup/version_requirements.txt b/build/pkgs/sage_setup/version_requirements.txt
index be5c8645b19..48a5d6a2975 100644
--- a/build/pkgs/sage_setup/version_requirements.txt
+++ b/build/pkgs/sage_setup/version_requirements.txt
@@ -1,2 +1,2 @@
# This file is updated on every release by the sage-update-version script
-sage-setup ~= 10.6b2
+sage-setup ~= 10.6b3
diff --git a/build/pkgs/sage_sws2rst/version_requirements.txt b/build/pkgs/sage_sws2rst/version_requirements.txt
index 734ca51955f..10fe0a5d243 100644
--- a/build/pkgs/sage_sws2rst/version_requirements.txt
+++ b/build/pkgs/sage_sws2rst/version_requirements.txt
@@ -1,2 +1,2 @@
# This file is updated on every release by the sage-update-version script
-sage-sws2rst ~= 10.6b2
+sage-sws2rst ~= 10.6b3
diff --git a/build/pkgs/sagelib/version_requirements.txt b/build/pkgs/sagelib/version_requirements.txt
index 9db5148c938..9955b423733 100644
--- a/build/pkgs/sagelib/version_requirements.txt
+++ b/build/pkgs/sagelib/version_requirements.txt
@@ -1,2 +1,2 @@
# This file is updated on every release by the sage-update-version script
-sagemath-standard ~= 10.6b2
+sagemath-standard ~= 10.6b3
diff --git a/build/pkgs/sagemath_bliss/version_requirements.txt b/build/pkgs/sagemath_bliss/version_requirements.txt
index bcd0492a487..07444bffe02 100644
--- a/build/pkgs/sagemath_bliss/version_requirements.txt
+++ b/build/pkgs/sagemath_bliss/version_requirements.txt
@@ -1,2 +1,2 @@
# This file is updated on every release by the sage-update-version script
-sagemath-bliss ~= 10.6b2
+sagemath-bliss ~= 10.6b3
diff --git a/build/pkgs/sagemath_categories/version_requirements.txt b/build/pkgs/sagemath_categories/version_requirements.txt
index 71d3e4365fb..3693bc6b268 100644
--- a/build/pkgs/sagemath_categories/version_requirements.txt
+++ b/build/pkgs/sagemath_categories/version_requirements.txt
@@ -1,2 +1,2 @@
# This file is updated on every release by the sage-update-version script
-sagemath-categories ~= 10.6b2
+sagemath-categories ~= 10.6b3
diff --git a/build/pkgs/sagemath_coxeter3/version_requirements.txt b/build/pkgs/sagemath_coxeter3/version_requirements.txt
index fc343e41411..218445145e4 100644
--- a/build/pkgs/sagemath_coxeter3/version_requirements.txt
+++ b/build/pkgs/sagemath_coxeter3/version_requirements.txt
@@ -1,2 +1,2 @@
# This file is updated on every release by the sage-update-version script
-sagemath-coxeter3 ~= 10.6b2
+sagemath-coxeter3 ~= 10.6b3
diff --git a/build/pkgs/sagemath_doc_html/dependencies b/build/pkgs/sagemath_doc_html/dependencies
index 40717629a77..ef59cbb539b 100644
--- a/build/pkgs/sagemath_doc_html/dependencies
+++ b/build/pkgs/sagemath_doc_html/dependencies
@@ -1,4 +1,4 @@
-sagelib sphinx sphinx_copybutton sphinx_inline_tabs pplpy_doc | $(SAGERUNTIME) maxima networkx scipy sympy matplotlib pillow mathjax mpmath ipykernel jupyter_client conway_polynomials tachyon ipywidgets sage_docbuild elliptic_curves furo fpylll graphs
+sagelib sphinx sphinx_copybutton sphinx_inline_tabs pplpy_doc | $(SAGERUNTIME) maxima networkx scipy sympy matplotlib pillow mathjax mpmath ipykernel jupyter_client conway_polynomials tachyon ipywidgets sage_docbuild elliptic_curves furo fpylll graphs typing_extensions
# Building the documentation has many dependencies, because all
# documented modules are imported and because we use matplotlib to
diff --git a/build/pkgs/sagemath_environment/version_requirements.txt b/build/pkgs/sagemath_environment/version_requirements.txt
index 837e63fe820..f8afafd91b2 100644
--- a/build/pkgs/sagemath_environment/version_requirements.txt
+++ b/build/pkgs/sagemath_environment/version_requirements.txt
@@ -1,2 +1,2 @@
# This file is updated on every release by the sage-update-version script
-sagemath-environment ~= 10.6b2
+sagemath-environment ~= 10.6b3
diff --git a/build/pkgs/sagemath_mcqd/version_requirements.txt b/build/pkgs/sagemath_mcqd/version_requirements.txt
index 21dcc676acf..c2a89dc2f8b 100644
--- a/build/pkgs/sagemath_mcqd/version_requirements.txt
+++ b/build/pkgs/sagemath_mcqd/version_requirements.txt
@@ -1,2 +1,2 @@
# This file is updated on every release by the sage-update-version script
-sagemath-mcqd ~= 10.6b2
+sagemath-mcqd ~= 10.6b3
diff --git a/build/pkgs/sagemath_meataxe/version_requirements.txt b/build/pkgs/sagemath_meataxe/version_requirements.txt
index 510a8736cf5..2347bb33a2a 100644
--- a/build/pkgs/sagemath_meataxe/version_requirements.txt
+++ b/build/pkgs/sagemath_meataxe/version_requirements.txt
@@ -1,2 +1,2 @@
# This file is updated on every release by the sage-update-version script
-sagemath-meataxe ~= 10.6b2
+sagemath-meataxe ~= 10.6b3
diff --git a/build/pkgs/sagemath_objects/version_requirements.txt b/build/pkgs/sagemath_objects/version_requirements.txt
index b5877570307..f332b86d4c1 100644
--- a/build/pkgs/sagemath_objects/version_requirements.txt
+++ b/build/pkgs/sagemath_objects/version_requirements.txt
@@ -1,2 +1,2 @@
# This file is updated on every release by the sage-update-version script
-sagemath-objects ~= 10.6b2
+sagemath-objects ~= 10.6b3
diff --git a/build/pkgs/sagemath_repl/version_requirements.txt b/build/pkgs/sagemath_repl/version_requirements.txt
index 8d7fca3395c..334e1a9cd4c 100644
--- a/build/pkgs/sagemath_repl/version_requirements.txt
+++ b/build/pkgs/sagemath_repl/version_requirements.txt
@@ -1,2 +1,2 @@
# This file is updated on every release by the sage-update-version script
-sagemath-repl ~= 10.6b2
+sagemath-repl ~= 10.6b3
diff --git a/build/pkgs/sagemath_sirocco/version_requirements.txt b/build/pkgs/sagemath_sirocco/version_requirements.txt
index 18111e8fa2d..83304b67094 100644
--- a/build/pkgs/sagemath_sirocco/version_requirements.txt
+++ b/build/pkgs/sagemath_sirocco/version_requirements.txt
@@ -1,2 +1,2 @@
# This file is updated on every release by the sage-update-version script
-sagemath-sirocco ~= 10.6b2
+sagemath-sirocco ~= 10.6b3
diff --git a/build/pkgs/sagemath_tdlib/version_requirements.txt b/build/pkgs/sagemath_tdlib/version_requirements.txt
index b297935ac75..162e0933241 100644
--- a/build/pkgs/sagemath_tdlib/version_requirements.txt
+++ b/build/pkgs/sagemath_tdlib/version_requirements.txt
@@ -1,2 +1,2 @@
# This file is updated on every release by the sage-update-version script
-sagemath-tdlib ~= 10.6b2
+sagemath-tdlib ~= 10.6b3
diff --git a/conftest.py b/conftest.py
new file mode 100644
index 00000000000..5307d7f6233
--- /dev/null
+++ b/conftest.py
@@ -0,0 +1,347 @@
+# pyright: strict
+"""Configuration and fixtures for pytest.
+
+This file configures pytest and provides some global fixtures.
+See https://docs.pytest.org/en/latest/index.html for more details.
+"""
+
+from __future__ import annotations
+
+import doctest
+import inspect
+import sys
+import warnings
+from pathlib import Path
+from typing import Any, Iterable, Optional
+
+import pytest
+from _pytest.doctest import (
+ DoctestItem,
+ DoctestModule,
+ _get_continue_on_failure,
+ _get_runner,
+ _is_mocked,
+ _patch_unwrap_mock_aware,
+ get_optionflags,
+)
+from _pytest.pathlib import ImportMode, import_path
+
+from sage.doctest.forker import (
+ init_sage,
+ showwarning_with_traceback,
+)
+from sage.doctest.parsing import SageDocTestParser, SageOutputChecker
+
+
+class SageDoctestModule(DoctestModule):
+ """
+ This is essentially a copy of `DoctestModule` from
+ https://github.com/pytest-dev/pytest/blob/main/src/_pytest/doctest.py.
+ The only change is that we use `SageDocTestParser` to extract the doctests
+ and `SageOutputChecker` to verify the output.
+ """
+
+ def collect(self) -> Iterable[DoctestItem]:
+ import doctest
+
+ class MockAwareDocTestFinder(doctest.DocTestFinder):
+ """A hackish doctest finder that overrides stdlib internals to fix a stdlib bug.
+ https://github.com/pytest-dev/pytest/issues/3456
+ https://bugs.python.org/issue25532
+ """
+
+ def __init__(self) -> None:
+ super().__init__(parser=SageDocTestParser(set(["sage"])))
+
+ def _find_lineno(self, obj, source_lines):
+ """Doctest code does not take into account `@property`, this
+ is a hackish way to fix it. https://bugs.python.org/issue17446
+ Wrapped Doctests will need to be unwrapped so the correct
+ line number is returned. This will be reported upstream. #8796
+ """
+ if isinstance(obj, property):
+ obj = getattr(obj, "fget", obj)
+
+ if hasattr(obj, "__wrapped__"):
+ # Get the main obj in case of it being wrapped
+ obj = inspect.unwrap(obj)
+
+ # Type ignored because this is a private function.
+ return super()._find_lineno( # type:ignore[misc]
+ obj,
+ source_lines,
+ )
+
+ def _find(
+ self, tests, obj, name, module, source_lines, globs, seen
+ ) -> None:
+ if _is_mocked(obj):
+ return
+ with _patch_unwrap_mock_aware():
+ # Type ignored because this is a private function.
+ super()._find( # type:ignore[misc]
+ tests, obj, name, module, source_lines, globs, seen
+ )
+
+ if self.path.name == "conftest.py":
+ module = self.config.pluginmanager._importconftest(
+ self.path,
+ self.config.getoption("importmode"),
+ rootpath=self.config.rootpath,
+ consider_namespace_packages=True,
+ )
+ else:
+ try:
+ module = import_path(
+ self.path,
+ mode=ImportMode.importlib,
+ root=self.config.rootpath,
+ consider_namespace_packages=True,
+ )
+ except ImportError as exception:
+ if self.config.getvalue("doctest_ignore_import_errors"):
+ pytest.skip("unable to import module %r" % self.path)
+ else:
+ if isinstance(exception, ModuleNotFoundError):
+ # Ignore some missing features/modules for now
+ # TODO: Remove this once all optional things are using Features
+ if exception.name in (
+ "valgrind",
+ "rpy2",
+ "sage.libs.coxeter3.coxeter",
+ ):
+ pytest.skip(
+ f"unable to import module { self.path } due to missing feature { exception.name }"
+ )
+ raise
+ # Uses internal doctest module parsing mechanism.
+ finder = MockAwareDocTestFinder()
+ optionflags = get_optionflags(self.config)
+ from sage.features import FeatureNotPresentError
+
+ runner = _get_runner(
+ verbose=False,
+ optionflags=optionflags,
+ checker=SageOutputChecker(),
+ continue_on_failure=_get_continue_on_failure(self.config),
+ )
+ try:
+ for test in finder.find(module, module.__name__):
+ if test.examples: # skip empty doctests
+ yield DoctestItem.from_parent(
+ self, name=test.name, runner=runner, dtest=test
+ )
+ except FeatureNotPresentError as exception:
+ pytest.skip(
+ f"unable to import module { self.path } due to missing feature { exception.feature.name }"
+ )
+ except ModuleNotFoundError as exception:
+ # TODO: Remove this once all optional things are using Features
+ pytest.skip(
+ f"unable to import module { self.path } due to missing module { exception.name }"
+ )
+
+
+class IgnoreCollector(pytest.Collector):
+ """
+ Ignore a file.
+ """
+
+ def __init__(self, parent: pytest.Collector) -> None:
+ super().__init__("ignore", parent)
+
+ def collect(self) -> Iterable[pytest.Item | pytest.Collector]:
+ return []
+
+
+def pytest_collect_file(
+ file_path: Path, parent: pytest.Collector
+) -> pytest.Collector | None:
+ """
+ This hook is called when collecting test files, and can be used to
+ modify the file or test selection logic by returning a list of
+ ``pytest.Item`` objects which the ``pytest`` command will directly
+ add to the list of test items.
+
+ See `pytest documentation