Skip to content

Run snmpsim via uvx in isolated Python 3.11 environment#4009

Merged
lunkwill42 merged 2 commits into
masterfrom
bugfix/snmpsim-uvx-python311
May 18, 2026
Merged

Run snmpsim via uvx in isolated Python 3.11 environment#4009
lunkwill42 merged 2 commits into
masterfrom
bugfix/snmpsim-uvx-python311

Conversation

@lunkwill42

Copy link
Copy Markdown
Member

Scope and purpose

snmpsim has a severe performance regression on Python 3.13+ where the new dbm.sqlite3 default backend causes every write during index building to fsync individually, resulting in ~25x slowdown (see pysnmp#223, snmpsim PR#10).

The snmpsim test fixture now prefers running via uvx --python=3.11 in an isolated environment. Falls back to a locally installed snmpsim-command-responder with a warning on Python 3.13+. Also detects premature process exit in the wait loop instead of spinning indefinitely.

Note

If a fix lands upstream in snmpsim (e.g. snmpsim PR#10 is merged), we should revisit this and potentially remove the uvx/Python 3.11 workaround.

Contributor Checklist

  • Added a changelog fragment for towncrier (not user-facing)
  • Added/amended tests for new/changed code
  • Added/changed documentation
  • Linted/formatted the code with ruff, easiest by using pre-commit
  • Wrote the commit message so that the first line continues the sentence "If applied, this commit will ...", starts with a capital letter, does not end with punctuation and is 50 characters or less long. See https://cbea.ms/git-commit/
  • Based this pull request on the correct upstream branch: For a patch/bugfix affecting the latest stable version, it should be based on that version's branch (<major>.<minor>.x). For a new feature or other additions, it should be based on master.
  • If applicable: Created new issues if this PR does not fix the issue completely/there is further work to be done
  • If it's not obvious from a linked issue, described how to interact with NAV in order for a reviewer to observe the effects of this change first-hand (commands, URLs, UI interactions)
  • If this results in changes in the UI: Added screenshots of the before and after
  • If this adds a new Python source code file: Added the boilerplate header to that file

snmpsim has a severe performance regression on Python 3.13+ where the
new `dbm.sqlite3` default backend causes every write during index
building to fsync individually, resulting in ~25x slowdown.

The `snmpsim` fixture now prefers running via `uvx --python=3.11` in
an isolated environment.  Falls back to a locally installed
`snmpsim-command-responder` with a warning on Python 3.13+.

Also detects premature process exit in the wait loop instead of
spinning indefinitely.
@lunkwill42
lunkwill42 requested review from a team and johannaengland May 13, 2026 11:59
@lunkwill42 lunkwill42 self-assigned this May 13, 2026
@github-actions

github-actions Bot commented May 13, 2026

Copy link
Copy Markdown

Test results

    3 files      3 suites   4m 18s ⏱️
3 025 tests 3 025 ✅ 0 💤 0 ❌
3 026 runs  3 026 ✅ 0 💤 0 ❌

Results for commit 6b1abd3.

♻️ This comment has been updated with latest results.

@codecov

codecov Bot commented May 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.23%. Comparing base (96a0e96) to head (6b1abd3).
⚠️ Report is 16 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4009   +/-   ##
=======================================
  Coverage   64.23%   64.23%           
=======================================
  Files         629      629           
  Lines       46669    46666    -3     
  Branches       43       43           
=======================================
  Hits        29978    29978           
+ Misses      16681    16678    -3     
  Partials       10       10           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@johannaengland johannaengland added the nonews No news fragment is necessary for this PR (e.g. refactoring, cleanups, workflow/development changes) label May 13, 2026

@johannaengland johannaengland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just a nitpick about a function name

Comment thread tests/integration/conftest.py Outdated
As suggested in review

Co-authored-by: Johanna England <johanna.england@sikt.no>
@lunkwill42
lunkwill42 force-pushed the bugfix/snmpsim-uvx-python311 branch from 81ab0ea to 6b1abd3 Compare May 18, 2026 08:28
@sonarqubecloud

Copy link
Copy Markdown

@lunkwill42
lunkwill42 merged commit d6e4eb3 into master May 18, 2026
17 checks passed
@lunkwill42
lunkwill42 deleted the bugfix/snmpsim-uvx-python311 branch May 18, 2026 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nonews No news fragment is necessary for this PR (e.g. refactoring, cleanups, workflow/development changes)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants