--- Begin Message ---
Package: src:sqlfluff
Version: 1.4.5-2
Severity: important
Tags: sid trixie
User: debian-pyt...@lists.debian.org
Usertags: python3.12
sqlfluff's autopkg tests fail with Python 3.12:
[...]
1626s =================================== FAILURES
===================================
1626s ___________
test__templater_full[jinja_j_libraries/jinja-True-False] ___________
1626s
1626s subpath = 'jinja_j_libraries/jinja', code_only = True,
include_meta = False
1626s yaml_loader = <function load_yaml at 0x7fe412ec6980>
1626s caplog = <_pytest.logging.LogCaptureFixture object at 0x7fe412a1e4e0>
1626s
1626s @pytest.mark.parametrize(
1626s "subpath,code_only,include_meta",
1626s [
1626s # Config Scalar
1626s ("jinja_a/jinja", True, False),
1626s # Macros
1626s ("jinja_b/jinja", False, False),
1626s # dbt builtins
1626s ("jinja_c_dbt/dbt_builtins_config", True, False),
1626s ("jinja_c_dbt/dbt_builtins_is_incremental", True, False),
1626s ("jinja_c_dbt/dbt_builtins_ref", True, False),
1626s ("jinja_c_dbt/dbt_builtins_source", True, False),
1626s ("jinja_c_dbt/dbt_builtins_this", True, False),
1626s ("jinja_c_dbt/dbt_builtins_var_default", True, False),
1626s # do directive
1626s ("jinja_e/jinja", True, False),
1626s # case sensitivity and python literals
1626s ("jinja_f/jinja", True, False),
1626s # Macro loading from a folder
1626s ("jinja_g_macros/jinja", True, False),
1626s # jinja raw tag
1626s ("jinja_h_macros/jinja", True, False),
1626s ("jinja_i_raw/raw_tag", True, False),
1626s ("jinja_i_raw/raw_tag_2", True, False),
1626s # Library Loading from a folder
1626s ("jinja_j_libraries/jinja", True, False),
1626s # Priority of macros
1626s ("jinja_k_config_override_path_macros/jinja", True,
False),
1626s # Placeholders and metas
1626s ("jinja_l_metas/001", False, True),
1626s ("jinja_l_metas/002", False, True),
1626s ("jinja_l_metas/003", False, True),
1626s ("jinja_l_metas/004", False, True),
1626s ("jinja_l_metas/005", False, True),
1626s ("jinja_l_metas/006", False, True),
1626s # Library Loading from a folder when library is module
1626s ("jinja_m_libraries_module/jinja", True, False),
1626s ("jinja_n_nested_macros/jinja", True, False),
1626s # Test more dbt configurations
1626s
("jinja_o_config_override_dbt_builtins/override_dbt_builtins", True, False),
1626s ("jinja_p_disable_dbt_builtins/disable_dbt_builtins",
True, False),
1626s # Load all the macros
1626s ("jinja_q_multiple_path_macros/jinja", True, False),
1626s ],
1626s )
1626s def test__templater_full(subpath, code_only, include_meta,
yaml_loader, caplog):
1626s """Check structure can be parsed from jinja templated
files."""
1626s # Log the templater and lexer throughout this test
1626s caplog.set_level(logging.DEBUG, logger="sqlfluff.templater")
1626s caplog.set_level(logging.DEBUG, logger="sqlfluff.lexer")
1626s
1626s > assert_structure(
1626s yaml_loader,
1626s "test/fixtures/templater/" + subpath,
1626s code_only=code_only,
1626s include_meta=include_meta,
1626s )
1626s
1626s test/core/templaters/jinja_test.py:619:
1626s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _
1626s test/core/templaters/jinja_test.py:553: in assert_structure
1626s p = list(lntr.parse_path(path + ".sql"))
1626s
/usr/lib/python3/dist-packages/sqlfluff/core/linter/linter.py:1204: in
parse_path
1626s yield self.parse_string(
1626s /usr/lib/python3/dist-packages/sqlfluff/core/linter/linter.py:867:
in parse_string
1626s rendered = self.render_string(in_str, fname, config, encoding)
1626s /usr/lib/python3/dist-packages/sqlfluff/core/linter/linter.py:816:
in render_string
1626s templated_file, templater_violations = self.templater.process(
1626s
/usr/lib/python3/dist-packages/sqlfluff/core/templaters/base.py:53: in
_wrapped
1626s return func(self, in_str=in_str, fname=fname, config=config,
**kwargs)
1626s
/usr/lib/python3/dist-packages/sqlfluff/core/templaters/jinja.py:376: in
process
1626s env, live_context, make_template = self.template_builder(
1626s
/usr/lib/python3/dist-packages/sqlfluff/core/templaters/jinja.py:331: in
template_builder
1626s live_context = self.get_context(fname=fname, config=config,
env=env)
1626s
/usr/lib/python3/dist-packages/sqlfluff/core/templaters/jinja.py:291: in
get_context
1626s
live_context.update(self._extract_libraries_from_config(config=config))
1626s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _
1626s
1626s self = <sqlfluff.core.templaters.jinja.JinjaTemplater object at
0x7fe4128d08c0>
1626s config = <sqlfluff.core.config.FluffConfig object at 0x7fe411019ac0>
1626s
1626s def _extract_libraries_from_config(self, config):
1626s library_path = config.get_section(
1626s (self.templater_selector, self.name, "library_path")
1626s )
1626s if not library_path:
1626s return {}
1626s
1626s libraries = JinjaTemplater.Libraries()
1626s
1626s # If library_path has __init__.py we parse it as one
module, else we parse it
1626s # a set of modules
1626s is_library_module =
os.path.exists(os.path.join(library_path, "__init__.py"))
1626s library_module_name = os.path.basename(library_path)
1626s
1626s # Need to go one level up to parse as a module correctly
1626s walk_path = (
1626s os.path.join(library_path, "..") if is_library_module
else library_path
1626s )
1626s
1626s for loader, module_name, is_pkg in
pkgutil.walk_packages([walk_path]):
1626s # skip other modules that can be near module_dir
1626s if is_library_module and not
module_name.startswith(library_module_name):
1626s continue
1626s
1626s > module =
loader.find_module(module_name).load_module(module_name)
1626s E AttributeError: 'FileFinder' object has no attribute
'find_module'
1626s
1626s
/usr/lib/python3/dist-packages/sqlfluff/core/templaters/jinja.py:154:
AttributeError
1626s _______
test__templater_full[jinja_m_libraries_module/jinja-True-False] ________
1626s
1626s subpath = 'jinja_m_libraries_module/jinja', code_only = True
1626s include_meta = False, yaml_loader = <function load_yaml at
0x7fe412ec6980>
1626s caplog = <_pytest.logging.LogCaptureFixture object at 0x7fe411019e20>
1626s
1626s @pytest.mark.parametrize(
1626s "subpath,code_only,include_meta",
1626s [
1626s # Config Scalar
1626s ("jinja_a/jinja", True, False),
1626s # Macros
1626s ("jinja_b/jinja", False, False),
1626s # dbt builtins
1626s ("jinja_c_dbt/dbt_builtins_config", True, False),
1626s ("jinja_c_dbt/dbt_builtins_is_incremental", True, False),
1626s ("jinja_c_dbt/dbt_builtins_ref", True, False),
1626s ("jinja_c_dbt/dbt_builtins_source", True, False),
1626s ("jinja_c_dbt/dbt_builtins_this", True, False),
1626s ("jinja_c_dbt/dbt_builtins_var_default", True, False),
1626s # do directive
1626s ("jinja_e/jinja", True, False),
1626s # case sensitivity and python literals
1626s ("jinja_f/jinja", True, False),
1626s # Macro loading from a folder
1626s ("jinja_g_macros/jinja", True, False),
1626s # jinja raw tag
1626s ("jinja_h_macros/jinja", True, False),
1626s ("jinja_i_raw/raw_tag", True, False),
1626s ("jinja_i_raw/raw_tag_2", True, False),
1626s # Library Loading from a folder
1626s ("jinja_j_libraries/jinja", True, False),
1626s # Priority of macros
1626s ("jinja_k_config_override_path_macros/jinja", True,
False),
1626s # Placeholders and metas
1626s ("jinja_l_metas/001", False, True),
1626s ("jinja_l_metas/002", False, True),
1626s ("jinja_l_metas/003", False, True),
1626s ("jinja_l_metas/004", False, True),
1626s ("jinja_l_metas/005", False, True),
1626s ("jinja_l_metas/006", False, True),
1626s # Library Loading from a folder when library is module
1626s ("jinja_m_libraries_module/jinja", True, False),
1626s ("jinja_n_nested_macros/jinja", True, False),
1626s # Test more dbt configurations
1626s
("jinja_o_config_override_dbt_builtins/override_dbt_builtins", True, False),
1626s ("jinja_p_disable_dbt_builtins/disable_dbt_builtins",
True, False),
1626s # Load all the macros
1626s ("jinja_q_multiple_path_macros/jinja", True, False),
1626s ],
1626s )
1626s def test__templater_full(subpath, code_only, include_meta,
yaml_loader, caplog):
1626s """Check structure can be parsed from jinja templated
files."""
1626s # Log the templater and lexer throughout this test
1626s caplog.set_level(logging.DEBUG, logger="sqlfluff.templater")
1626s caplog.set_level(logging.DEBUG, logger="sqlfluff.lexer")
1626s
1626s > assert_structure(
1626s yaml_loader,
1626s "test/fixtures/templater/" + subpath,
1626s code_only=code_only,
1626s include_meta=include_meta,
1626s )
1626s
1626s test/core/templaters/jinja_test.py:619:
1626s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _
1626s test/core/templaters/jinja_test.py:553: in assert_structure
1626s p = list(lntr.parse_path(path + ".sql"))
1626s
/usr/lib/python3/dist-packages/sqlfluff/core/linter/linter.py:1204: in
parse_path
1626s yield self.parse_string(
1626s /usr/lib/python3/dist-packages/sqlfluff/core/linter/linter.py:867:
in parse_string
1626s rendered = self.render_string(in_str, fname, config, encoding)
1626s /usr/lib/python3/dist-packages/sqlfluff/core/linter/linter.py:816:
in render_string
1626s templated_file, templater_violations = self.templater.process(
1626s
/usr/lib/python3/dist-packages/sqlfluff/core/templaters/base.py:53: in
_wrapped
1626s return func(self, in_str=in_str, fname=fname, config=config,
**kwargs)
1626s
/usr/lib/python3/dist-packages/sqlfluff/core/templaters/jinja.py:376: in
process
1626s env, live_context, make_template = self.template_builder(
1626s
/usr/lib/python3/dist-packages/sqlfluff/core/templaters/jinja.py:331: in
template_builder
1626s live_context = self.get_context(fname=fname, config=config,
env=env)
1626s
/usr/lib/python3/dist-packages/sqlfluff/core/templaters/jinja.py:291: in
get_context
1626s
live_context.update(self._extract_libraries_from_config(config=config))
1626s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _
1626s
1626s self = <sqlfluff.core.templaters.jinja.JinjaTemplater object at
0x7fe40bc6f8c0>
1626s config = <sqlfluff.core.config.FluffConfig object at 0x7fe41101bf20>
1626s
1626s def _extract_libraries_from_config(self, config):
1626s library_path = config.get_section(
1626s (self.templater_selector, self.name, "library_path")
1626s )
1626s if not library_path:
1626s return {}
1626s
1626s libraries = JinjaTemplater.Libraries()
1626s
1626s # If library_path has __init__.py we parse it as one
module, else we parse it
1626s # a set of modules
1626s is_library_module =
os.path.exists(os.path.join(library_path, "__init__.py"))
1626s library_module_name = os.path.basename(library_path)
1626s
1626s # Need to go one level up to parse as a module correctly
1626s walk_path = (
1626s os.path.join(library_path, "..") if is_library_module
else library_path
1626s )
1626s
1626s for loader, module_name, is_pkg in
pkgutil.walk_packages([walk_path]):
1626s # skip other modules that can be near module_dir
1626s if is_library_module and not
module_name.startswith(library_module_name):
1626s continue
1626s
1626s > module =
loader.find_module(module_name).load_module(module_name)
1626s E AttributeError: 'FileFinder' object has no attribute
'find_module'
1626s
1626s
/usr/lib/python3/dist-packages/sqlfluff/core/templaters/jinja.py:154:
AttributeError
1626s =============================== warnings summary
===============================
1626s test/cli/commands_test.py: 718 warnings
1626s /usr/lib/python3/dist-packages/tqdm/std.py:468:
DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated
and scheduled for removal in a future version. Use timezone-aware
objects to represent datetimes in UTC:
datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
1626s if rate and total else datetime.utcfromtimestamp(0))
1626s
1626s
test/core/linter_test.py::test__linter__linting_result_get_violations[2]
1626s
test/core/linter_test.py::test__linter__linting_result_get_violations[2]
1626s /usr/lib/python3.12/multiprocessing/popen_fork.py:66:
DeprecationWarning: This process (pid=1484) is multi-threaded, use of
fork() may lead to deadlocks in the child.
1626s self.pid = os.fork()
1626s
1626s -- Docs:
https://docs.pytest.org/en/stable/how-to/capture-warnings.html
1626s =========================== short test summary info
============================
1626s FAILED
test/core/templaters/jinja_test.py::test__templater_full[jinja_j_libraries/jinja-True-False]
1626s FAILED
test/core/templaters/jinja_test.py::test__templater_full[jinja_m_libraries_module/jinja-True-False]
1626s ========== 2 failed, 5635 passed, 720 warnings in 1440.02s
(0:24:00) ===========
--- End Message ---