Skip to content

Split tests/test_codegen.py (10,019 lines) into feature-focused test files #419

@aallan

Description

@aallan

Background

tests/test_codegen.py has grown to 10,019 lines across 118 test classes. Finding tests for a specific feature, understanding failure scope, and parallelising CI execution are all harder than they need to be. This mirrors the situation that prompted the original codegen decomposition in #155.

Proposed split

New file Test classes Theme
tests/test_codegen_literals.py TestIntLit, TestBoolLit, TestFloatLit, TestByteLit Literal values
tests/test_codegen_arithmetic.py TestArithmetic, TestComparison, TestFloatArithmetic, TestFloatComparison, TestFloatNeg Numeric ops
tests/test_codegen_control_flow.py TestIfExpr, TestMatchExpr, TestLetStmt, TestForallExpr, TestExistsExpr, TestFloatIfExpr, TestFloatLet Control flow
tests/test_codegen_strings.py All string operation test classes String builtins
tests/test_codegen_arrays.py All array operation test classes Array builtins
tests/test_codegen_collections.py Map and Set test classes Map/Set builtins
tests/test_codegen_effects.py Http, Inference, IO effect test classes Effect codegen
tests/test_codegen_data_types.py ADT constructor and pattern match test classes Data types
tests/test_codegen_functions.py TestCompile, TestCompileResult, TestSlotRef, TestFloatSlotRef, TestFloatCompileResult Function compilation

The shared helpers (_compile(), _compile_ok(), _run(), _run_float(), _run_io(), _run_trap()) move to tests/conftest.py so every split file can import them without duplication.

Acceptance criteria

  • All existing tests are preserved (same count, same names)
  • pytest tests/ -v passes
  • Each new file is under 1,500 lines
  • No test helpers duplicated across files

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactorCode refactoring and structural improvements

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions