sample_generation/rule.py randint() crashes under Python 3.13 (float args no longer accepted)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start at pytest_splunk_addon/sample_generation/rule.py:684 and inspect the other randint call sites in that file. Reproduce the failure under Python 3.13 through the sample generation path, then verify that the affected calls accept integer bounds and that the knowledge/modinput test session completes without the INTERNALERROR.
Written by the indexing model from the issue text.
Description
Under Python 3.13, random.randint(earliest_in_epoch, latest_in_epoch) in pytest_splunk_addon/sample_generation/rule.py:684 raises TypeError: 'float' object cannot be interpreted as an integer. Python 3.13 tightened random.randrange to reject non-integer arguments outright — on earlier versions (e.g. 3.9) this was only a DeprecationWarning.
This crashes pytest_sessionstart inside AppTestGenerator (via sample_generator.get_samples() → rule.apply() → rule.replace()), so pytest exits with INTERNALERROR, produces no JUnit XML report, and the whole test session fails before any test runs.
Repro: run any TA's knowledge/modinput tests with python-version: 3.13 in wfe-test-runner-action. Example: splunk-add-on-for-microsoft-sysmon run 29721237033, job run-knowledge-tests (10.4.1) — https://github.com/splunk/splunk-add-on-for-microsoft-sysmon/actions/runs/29721237033/job/88285117187
INTERNALERROR> File ".../pytest_splunk_addon/sample_generation/rule.py", line 684, in replace
INTERNALERROR> randint(earliest_in_epoch, latest_in_epoch)
INTERNALERROR> File "/usr/lib/python3.13/random.py", line 340, in randint
INTERNALERROR> return self.randrange(a, b+1)
INTERNALERROR> File "/usr/lib/python3.13/random.py", line 305, in randrange
INTERNALERROR> istart = _index(start)
INTERNALERROR> TypeError: 'float' object cannot be interpreted as an integer
Fix should coerce earliest_in_epoch/latest_in_epoch (and any other randint call sites in this file) to int before calling randint.
Found while validating ADDON-89094's Python 3.9→3.13 bump for addonfactory-workflow-addon-release's v5.6.0 release (ADDON-88923 epic).
- Dominant language
- Python
- Stars
- 66
- Forks
- 21
- Avg merge
- 4d 13h
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from splunk/pytest-splunk-addon
-
Difficulty 3/5 1-2 days Newbie friendliness 70/100
splunk/pytest-splunk-addon#967 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
splunk/pytest-splunk-addon#963 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
splunk/pytest-splunk-addon#895 ·
-
enhancement major
Difficulty 3/5 1-2 days Newbie friendliness 45/100
splunk/pytest-splunk-addon#549 ·
-
bug enhancement
splunk/pytest-splunk-addon#548 · 1 comment · 1 assignee ·
All issues in splunk/pytest-splunk-addon
Similar issues
-
area/auth bug comp/agent P3 platform/discord type/security
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
NousResearch/hermes-agent#117848 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100