Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_is_valid_should_not_mutate fails with Python 3.13 #405

Open
mcepl opened this issue Nov 20, 2024 · 2 comments
Open

test_is_valid_should_not_mutate fails with Python 3.13 #405

mcepl opened this issue Nov 20, 2024 · 2 comments

Comments

@mcepl
Copy link

mcepl commented Nov 20, 2024

When packaging new version of this package for openSUSE/Factory, test test_is_valid_should_not_mutate fails:

[   19s] =================================== FAILURES ===================================
[   19s] __________ test_is_valid_should_not_mutate[_invalidator_1-jsonschema] __________
[   19s] 
[   19s] cls = <class '_pytest.runner.CallInfo'>
[   19s] func = <function call_and_report.<locals>.<lambda> at 0x7fba491e0d60>
[   19s] when = 'call'
[   19s] reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)
[   19s] 
[   19s]     @classmethod
[   19s]     def from_call(
[   19s]         cls,
[   19s]         func: Callable[[], TResult],
[   19s]         when: Literal["collect", "setup", "call", "teardown"],
[   19s]         reraise: type[BaseException] | tuple[type[BaseException], ...] | None = None,
[   19s]     ) -> CallInfo[TResult]:
[   19s]         """Call func, wrapping the result in a CallInfo.
[   19s]     
[   19s]         :param func:
[   19s]             The function to call. Called without arguments.
[   19s]         :type func: Callable[[], _pytest.runner.TResult]
[   19s]         :param when:
[   19s]             The phase in which the function is called.
[   19s]         :param reraise:
[   19s]             Exception or exceptions that shall propagate if raised by the
[   19s]             function, instead of being wrapped in the CallInfo.
[   19s]         """
[   19s]         excinfo = None
[   19s]         start = timing.time()
[   19s]         precise_start = timing.perf_counter()
[   19s]         try:
[   19s] >           result: TResult | None = func()
[   19s] 
[   19s] cls        = <class '_pytest.runner.CallInfo'>
[   19s] duration   = 0.010382263993960805
[   19s] excinfo    = <ExceptionInfo PytestUnraisableExceptionWarning('Exception ignored in: <sqlite3.Connection object at 0x7fba492d4b80>\n...      ~~~~~~~~~~~~^^\nResourceWarning: unclosed database in <sqlite3.Connection object at 0x7fba492d4b80>\n') tblen=11>
[   19s] func       = <function call_and_report.<locals>.<lambda> at 0x7fba491e0d60>
[   19s] precise_start = 33629.259203216
[   19s] precise_stop = 33629.26958548
[   19s] reraise    = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)
[   19s] result     = None
[   19s] start      = 1732094445.8980231
[   19s] stop       = 1732094445.9084063
[   19s] when       = 'call'
[   19s] 
[   19s] /usr/lib/python3.13/site-packages/_pytest/runner.py:341: 
[   19s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[   19s] /usr/lib/python3.13/site-packages/_pytest/runner.py:242: in <lambda>
[   19s]     lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
[   19s]         item       = <Function test_is_valid_should_not_mutate[_invalidator_1-jsonschema]>
[   19s]         kwds       = {}
[   19s]         runtest_hook = <HookCaller 'pytest_runtest_call'>
[   19s] /usr/lib/python3.13/site-packages/pluggy/_hooks.py:513: in __call__
[   19s]     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
[   19s]         firstresult = False
[   19s]         kwargs     = {'item': <Function test_is_valid_should_not_mutate[_invalidator_1-jsonschema]>}
[   19s]         self       = <HookCaller 'pytest_runtest_call'>
[   19s] /usr/lib/python3.13/site-packages/pluggy/_manager.py:120: in _hookexec
[   19s]     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
[   19s]         firstresult = False
[   19s]         hook_name  = 'pytest_runtest_call'
[   19s]         kwargs     = {'item': <Function test_is_valid_should_not_mutate[_invalidator_1-jsonschema]>}
[   19s]         methods    = [<HookImpl plugin_name='runner', plugin=<module '_pytest.runner' from '/usr/lib/python3.13/site-packages/_pytest/runne...ption', plugin=<module '_pytest.threadexception' from '/usr/lib/python3.13/site-packages/_pytest/threadexception.py'>>]
[   19s]         self       = <_pytest.config.PytestPluginManager object at 0x7fba4a7602f0>
[   19s] /usr/lib/python3.13/site-packages/_pytest/threadexception.py:92: in pytest_runtest_call
[   19s]     yield from thread_exception_runtest_hook()
[   19s] /usr/lib/python3.13/site-packages/_pytest/threadexception.py:68: in thread_exception_runtest_hook
[   19s]     yield
[   19s]         cm         = <_pytest.threadexception.catch_threading_exception object at 0x7fba4923e990>
[   19s] /usr/lib/python3.13/site-packages/_pytest/unraisableexception.py:95: in pytest_runtest_call
[   19s]     yield from unraisable_exception_runtest_hook()
[   19s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[   19s] 
[   19s]     def unraisable_exception_runtest_hook() -> Generator[None]:
[   19s]         with catch_unraisable_exception() as cm:
[   19s]             try:
[   19s]                 yield
[   19s]             finally:
[   19s]                 if cm.unraisable:
[   19s]                     if cm.unraisable.err_msg is not None:
[   19s]                         err_msg = cm.unraisable.err_msg
[   19s]                     else:
[   19s]                         err_msg = "Exception ignored in"
[   19s]                     msg = f"{err_msg}: {cm.unraisable.object!r}\n\n"
[   19s]                     msg += "".join(
[   19s]                         traceback.format_exception(
[   19s]                             cm.unraisable.exc_type,
[   19s]                             cm.unraisable.exc_value,
[   19s]                         )
[   19s]                     )
[   19s] >                   warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
[   19s] E                   pytest.PytestUnraisableExceptionWarning: Exception ignored in: <sqlite3.Connection object at 0x7fba492d4b80>
[   19s] E                   
[   19s] E                   Traceback (most recent call last):
[   19s] E                     File "/usr/lib/python3.13/site-packages/jsonschema/exceptions.py", line 168, in _set
[   19s] E                       for k, v in kwargs.items():
[   19s] E                                   ~~~~~~~~~~~~^^
[   19s] E                   ResourceWarning: unclosed database in <sqlite3.Connection object at 0x7fba492d4b80>
[   19s] 
[   19s] cm         = <_pytest.unraisableexception.catch_unraisable_exception object at 0x7fba4923e8d0>
[   19s] err_msg    = 'Exception ignored in'
[   19s] msg        = 'Exception ignored in: <sqlite3.Connection object at 0x7fba492d4b80>\n\nTraceback (most recent call last):\n  File "/u...n                ~~~~~~~~~~~~^^\nResourceWarning: unclosed database in <sqlite3.Connection object at 0x7fba492d4b80>\n'
[   19s] 
[   19s] /usr/lib/python3.13/site-packages/_pytest/unraisableexception.py:85: PytestUnraisableExceptionWarning
[   19s] =============================== warnings summary ===============================
[   19s] ../../../../../usr/lib/python3.13/site-packages/jupyter_core/application.py:23
[   19s]   /usr/lib/python3.13/site-packages/jupyter_core/application.py:23: DeprecationWarning: Jupyter is migrating its paths to use standard platformdirs
[   19s]   given by the platformdirs library.  To remove this warning and
[   19s]   see the appropriate new directories, set the environment variable
[   19s]   `JUPYTER_PLATFORM_DIRS=1` and then run `jupyter --paths`.
[   19s]   The use of platformdirs will be the default in `jupyter_core` v6
[   19s]     from .paths import (
[   19s] 
[   19s] -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
[   19s] ============================= slowest 10 durations =============================
[   19s] 0.42s call     tests/test_sign.py::TestNotary::test_sign_stdin
[   19s] 0.04s call     tests/test_validator.py::test_future[fastjsonschema]
[   19s] 0.04s call     tests/test_validator.py::test_nb2[jsonschema]
[   19s] 0.03s call     tests/test_sign.py::TestNotary::test_cull_db
[   19s] 0.02s call     tests/test_api.py::TestAPI::test_capture_validation_error
[   19s] 0.02s call     tests/test_api.py::TestAPI::test_read
[   19s] 0.02s call     tests/test_validator.py::test_future[jsonschema]
[   19s] 0.02s call     tests/test_validator.py::test_invalid_validator_raises_value_error_after_read
[   19s] 0.02s call     tests/test_validator.py::test_nb4jupyter_metadata_timings[fastjsonschema]
[   19s] 0.02s call     tests/test_validator.py::test_nb4custom[fastjsonschema]
[   19s] =========================== short test summary info ============================
[   19s] SKIPPED [2] tests/test_validator.py:57: Does not work in all architectures
[   19s] FAILED tests/test_validator.py::test_is_valid_should_not_mutate[_invalidator_1-jsonschema]
[   19s] ============= 1 failed, 185 passed, 2 skipped, 1 warning in 1.28s ==============

Complete build log with the list of all packages used and steps taken to reproduce the problem. Notice, that whole test suite passes with 3.10 and 3.12.

@mcepl
Copy link
Author

mcepl commented Nov 20, 2024

Actually, it is somewhat more complicated, when I skip test_is_valid_should_not_mutate (with pytest -k 'not test_is_valid_should_not_mutate') I get the same error about not closing SQLite database with test_nb4custom, when I skip that, it fails with test_nb4jupyter_metadata_timings. I have not went further.

@mcepl
Copy link
Author

mcepl commented Nov 20, 2024

Tried to upgrade fastjsonschema to fastjsonschema-2.20.0, but nothing changed.

Build log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant