Skip to content

Fix false positives and modernise the 3.x test suite#8

Merged
eaguad1337 merged 2 commits into
3.xfrom
circulon/tests-overhaul
Jun 7, 2026
Merged

Fix false positives and modernise the 3.x test suite#8
eaguad1337 merged 2 commits into
3.xfrom
circulon/tests-overhaul

Conversation

@eaguad1337

Copy link
Copy Markdown
Contributor

Migrated from MasoniteFramework/orm#967 (original author: @circulon) as part of the move to the masonitedev organization. Ported onto current 3.x (cleo 2 CLI + #5/#6/#7) and hardened.

What this does

  • Fixes tests that had no assertions — several tests passed without asserting anything. Adds scripts/check_test_asserts.py and a CI step that fails if any test lacks an assertion, so false positives can't reappear.
  • Removes the tracked orm.sqlite3 fixture — a session conftest.py now builds the SQLite test database from migrations and seeds living under tests/integrations/ (moved there from the root databases/ folder, which is gone). *.sqlite3 is ignored, so test runs no longer dirty the working tree.
  • Enables previously commented-out tests and moves grammar query strings inline for readability.
  • CI: lint gate before the matrix, split migrate/test steps pointing at tests/integrations/migrations, modern action versions, concurrency cancellation.
  • Removes unused files (app observer fixture, legacy config/test-database.py).

Reconciliation notes (this port vs the original branch)

The original PR was written against pre-#7 3.x; the port keeps the now-merged behavior wherever they collided:

  • Inline *_increments_primary SQL (e.g. [id] INT IDENTITY NOT NULL PRIMARY KEY) instead of the old table-level primary key constraint expectations.
  • No implicit UNSIGNED on SQLite morphs/foreign columns.
  • .primary() kept on the relocated migrations' increments() columns.
  • Python 3.8 restored to the CI matrix (the original dropped it; the package still supports 3.8).

Bug found and fixed during the port

The new test_alter_drop_on_table_schema_table (SQLite) exposed a reverse-type-map collision: PRAGMA table_info returns bare storage types, and reversing the full type map let increments/tiny_increments/big_increments shadow integer/tiny_integer/big_integer (same storage types). Any ALTER that rebuilt a table with an INTEGER column raised QueryException: increments() not supported on non-primary key columns. The increments family is now excluded from the reversal (separate commit).

Tests

Full suite: 1058 passed, 0 failed — including the Postgres alter test that previously required a live server (now exercised through the rewritten suite), and the assert-checker reports every test asserts.

circulon and others added 2 commits June 7, 2026 13:54
Ported from MasoniteFramework/orm#967, reconciled with the merged
connection-caching, driver-options and increments-primary changes.

- Fix tests that had no assertions (technical false-positive passes) and
  enable previously commented-out tests.
- Add scripts/check_test_asserts.py plus a CI step ensuring every test
  contains at least one assertion.
- Remove the tracked orm.sqlite3 fixture: a session conftest now builds
  the SQLite database from migrations and seeds under tests/integrations/
  (moved there from the root databases/ folder, which is removed).
- Move grammar query strings into the tests for readability.
- CI: split migrate/test steps, point migrations at
  tests/integrations/migrations, modern action versions, lint via make
  check before the matrix runs.
- Remove unused files (app observer fixture, legacy test-database config).

Conflict resolutions during the port: kept the post-#7 platform SQL
expectations (inline increments primary keys, no implicit UNSIGNED on
SQLite) and the .primary() calls in the relocated migrations; restored
Python 3.8 to the CI matrix since the package still supports it.
PRAGMA table_info returns bare storage types, and the increments family
shares those storage types with the integer family (INTEGER, TINYINT,
BIGINT). Reversing the full type map let the increments variants win,
so any table with an INTEGER column raised 'increments() not supported
on non-primary key columns' when an ALTER rebuilt it. Exclude the
increments family from the reversal: rebuilt columns are plain integer
types and the primary key is preserved separately.
@eaguad1337 eaguad1337 merged commit 7bb9a1c into 3.x Jun 7, 2026
14 checks passed
@eaguad1337 eaguad1337 deleted the circulon/tests-overhaul branch June 7, 2026 17:56
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