From 8581f70742f078f2f22155fde7ad0b9d6e10180d Mon Sep 17 00:00:00 2001 From: Jamison Rose Date: Mon, 13 Jan 2025 18:34:34 -0800 Subject: [PATCH] Disable python 3.8 incompatible doctest (#2831) --- src/conftest.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/conftest.py b/src/conftest.py index 58b7cbd481c..8be82abab71 100644 --- a/src/conftest.py +++ b/src/conftest.py @@ -41,6 +41,27 @@ def pytest_runtest_makereport(item, call): return tr +# These tests require python packages that are no longer built for python 3.8 +PYTHON_38_SKIPS = { + "snowpark.session.Session.replicate_local_environment", + "snowpark.session.Session.table_function", +} + +DocTestFinder = doctest.DocTestFinder + + +class CustomDocTestFinder(DocTestFinder): + def _find(self, tests, obj, name, module, source_lines, globs, seen): + if name in PYTHON_38_SKIPS and sys.version_info < (3, 9): + return + return DocTestFinder._find( + self, tests, obj, name, module, source_lines, globs, seen + ) + + +doctest.DocTestFinder = CustomDocTestFinder + + # scope is module so that we ensure we delete the session before # moving onto running the tests in the tests dir. Having only one # session is important to certain UDF tests to pass , since they