Skip to content

Move tests to tests/, fix BINARY_OP for 3.12+#4

Open
sjbaebae wants to merge 1 commit intocybertronai:devfrom
sjbaebae:refactor/test-infra
Open

Move tests to tests/, fix BINARY_OP for 3.12+#4
sjbaebae wants to merge 1 commit intocybertronai:devfrom
sjbaebae:refactor/test-infra

Conversation

@sjbaebae
Copy link
Copy Markdown

@sjbaebae sjbaebae commented Apr 7, 2026

Summary

  • Move test files into tests/ with pyproject.toml pytest config
  • Fix strict tracer missing BINARY_OP handler (Python 3.12+ unified opcode)
  • Add TODO.md documenting known CPython 3.12 f_trace_opcodes bug and sys.monitoring migration path

Test results

Test plan

  • pytest tests/ -v on Python 3.12
  • Manual test run on Python 3.11 (all 33 pass)

- Move test files into tests/ directory with __init__.py
- Add pyproject.toml with pytest configuration (pythonpath, testpaths)
- Add BINARY_OP to strict tracer's opcode handler list (Python 3.12
  replaced individual BINARY_ADD etc. with unified BINARY_OP)
- Add TODO.md documenting known 3.12 f_trace_opcodes bug
  (python/cpython#103615) and future sys.monitoring migration path

32 tests pass, 1 known failure on CPython 3.12 (test_my_add_basic).
All tests pass on 3.11 and 3.13+.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@SethTS
Copy link
Copy Markdown

SethTS commented Apr 8, 2026

Seth's ClaudeCode reviewed the PR and had a suggestion:

Nice fix — the BINARY_OP addition makes sense and is clearly the right call.

One question: would it be worth just requiring Python 3.13+ and dropping 3.11/3.12 support entirely?

The reasoning: 3.12 has the known f_trace_opcodes bug (CPython #103615) that causes test_my_add_basic to fail, and 3.11 uses the old individual opcodes that this PR is partly working around. If we set requires-python = ">=3.13" in pyproject.toml, the known failure goes away, the test matrix collapses to a single version, and the sys.monitoring migration in your TODO becomes a nice-to-have rather than a necessary fix for 3.12 correctness.

The BINARY_OP fix in this PR is still needed on 3.13 (since 3.13 also uses the unified opcode), so this isn't saying the fix is wrong — just asking whether we could simplify the supported range at the same time.

Our env is sutro313 (Python 3.13.5) and the competition pipeline would presumably run on whatever Python we specify in CI, so there's no strong reason to carry the older versions if they're causing known failures.

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

Successfully merging this pull request may close these issues.

2 participants