Thanks to visit codestin.com
Credit goes to github.com

Skip to content

3.14 pytest issues: suppress sqlite3 warnings, add context managers to mp calls - #3719

Open
filefolder wants to merge 17 commits into
obspy:masterfrom
filefolder:py314_testfixes_march26
Open

3.14 pytest issues: suppress sqlite3 warnings, add context managers to mp calls#3719
filefolder wants to merge 17 commits into
obspy:masterfrom
filefolder:py314_testfixes_march26

Conversation

@filefolder

@filefolder filefolder commented Mar 22, 2026

Copy link
Copy Markdown
Contributor

python3.14 causing various test issues, some can be fixed on our end, others probably have to be ignored

  1. multiprocessing causing issues in pytest, solution is mostly to wrap in context managers and/or use threadpool.

  2. there are some places where SQLite databases aren't closing which 3.14 no longer tolerates. seems to only be a problem in pytest, solution is probably just to ignore these warnings and/or update pytest-cov.

  3. increased timeout buffer for py3.10 mindep ubuntu to 10 minutes (5 wasn't cutting it), force use of the faster libmamba solver which it didn't appear to be using.

based on master

@filefolder filefolder added testing issues generally related to our testing setup / infrastructure CI issue generally related to continuous integration labels Mar 22, 2026
@filefolder
filefolder removed the request for review from trichter March 22, 2026 06:36
@filefolder

Copy link
Copy Markdown
Contributor Author

OK this should be working now. I think it may be an issue with PROJ-- have just suppressed the sqlite warnings specific to the cartopy tests in the image_path function in pytest

@filefolder filefolder added the ready for review PRs that are ready to be reviewed to get marked ready to merge label Mar 31, 2026
Comment thread obspy/conftest.py Outdated
# which python 3.14 no longer tolerates
with warnings.catch_warnings():
warnings.simplefilter("ignore", ResourceWarning)
gc.collect()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks so weird.. calling gc.collect() and then it is emitting warnings too. I've seen some weird errors in pytest, so I assume it's one of those, do you have a link to an error on https://tests.obspy.org that gets fixed by this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes here: #3718

i am not sure gc.collect() actually needed there in hindsight.

seems like fundamentally it is out of our control so just filtering the warnings may be required, but i honestly couldn't figure it out

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does appear that the gc was needed afterall

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

link to actual test run: https://tests.obspy.org/155382/

@megies

megies commented Apr 21, 2026

Copy link
Copy Markdown
Member

see #3718 (comment)

@filefolder

Copy link
Copy Markdown
Contributor Author

suspect the new FDSN bug is 3.14 being stricter about a missing pool.close() or pool.terminate() in mass downloader. may have to go through all these.

@megies

megies commented Apr 22, 2026

Copy link
Copy Markdown
Member

I've tried locally with 3.14 though and could not replicate any of these.. have you been able to get these fails locally?

@filefolder
filefolder requested a review from nick-falco as a code owner April 25, 2026 06:31
@filefolder
filefolder removed the request for review from nick-falco April 25, 2026 06:32
@filefolder

Copy link
Copy Markdown
Contributor Author

I've tried locally with 3.14 though and could not replicate any of these.. have you been able to get these fails locally?

I have not.. but I think the issue could be here:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
    from multiprocessing.resource_tracker import main;main(14)
  File "/home/runner/miniconda3/envs/test/lib/python3.14/multiprocessing/resource_tracker.py", line 34, in <module>
    _IGNORED_SIGNALS = (signal.SIGINT, signal.SIGTERM)
                        ^^^^^^^^^^^^^
AttributeError: module 'signal' has no attribute 'SIGINT' (consider renaming '/home/runner/miniconda3/envs/test/lib/python3.14/site-packages/obspy/signal/__init__.py' since it has the same name as the standard library module named 'signal' and prevents importing that standard library module)

Which leaves the mp stuff hanging specifically in pytest due to the overlapping "signal" imports. I already had to change something else regarding this for the 1.5 release using some creative importing. Fortunately by wrapping the 3-4 multiprocessing calls in a context manager (now done here) the problem doesn't seem to fail in pytest anymore and is probably a bit more robust anyway.

Have re-shuffled a bit and mostly am now just suppressing the specific sqlite3 pytest warnings in pytest.ini.

There was also a new issue with py3.10 ubuntu mindep, the 5 minute timeout didn't seem to be enough. Have bumped to 10 and made the libmamba solver explicitly used. On that tangent maybe we should turn off the 3.8 and 3.9 tests now?

@filefolder filefolder changed the title modify two tests for py3.14 ubuntu 3.14 pytest issues: suppress sqlite3 warnings, add context managers to mp calls Apr 26, 2026
@megies

megies commented May 12, 2026

Copy link
Copy Markdown
Member

Looking at this again, I think it should go into maintenance branch? I've merged maintenance into master, so the sqlalchemy fixes are in there now and I will retrigger tests here now to see what the status is.

@ThomasLecocq

Copy link
Copy Markdown
Contributor

so the thing with "signal" being shadowed by obspy.signal is solved in #3789 - leaving this open for the other issues, we need to check if they still come up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI issue generally related to continuous integration ready for review PRs that are ready to be reviewed to get marked ready to merge testing issues generally related to our testing setup / infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants