Migration Testing¶
Here's the reference information for the migration testing classes, with all their parameters, attributes and methods.
You can import these classes directly from pyrmute:
pyrmute.MigrationTestCase
dataclass
¶
Test case for migration validation.
Defines input data and expected output for testing a migration function. If target is None, the test only verifies the migration doesn't crash.
| ATTRIBUTE | DESCRIPTION |
|---|---|
source |
Input data to migrate.
TYPE:
|
target |
Expected output after migration. If None, only validates that migration completes without errors.
TYPE:
|
description |
Optional description of what this test case validates.
TYPE:
|
Example
pyrmute.MigrationTestResult
dataclass
¶
Result of a single migration test case.
Contains the test case, actual output, pass/fail status, and any error message.
| ATTRIBUTE | DESCRIPTION |
|---|---|
test_case |
Original test case that was executed.
TYPE:
|
actual |
Actual output produced by the migration.
TYPE:
|
passed |
Whether the test passed (output matched expected or no errors).
TYPE:
|
error |
Error message if test failed, None if passed.
TYPE:
|
Example
pyrmute.MigrationTestResults
¶
Collection of migration test results.
Provides convenient methods for checking overall test status and accessing failed tests.
| ATTRIBUTE | DESCRIPTION |
|---|---|
results |
List of individual test results.
|
Example
Initialize test results collection.
| PARAMETER | DESCRIPTION |
|---|---|
results
|
List of individual test results.
TYPE:
|
Source code in src/pyrmute/migration_testing.py
all_passed
property
¶
Check if all tests passed.
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if all tests passed, False if any failed. |
failures
property
¶
Get list of failed tests.
| RETURNS | DESCRIPTION |
|---|---|
list[MigrationTestResult]
|
List of test results that failed. |
assert_all_passed
¶
Assert all tests passed, raising detailed error if any failed.
| RAISES | DESCRIPTION |
|---|---|
AssertionError
|
If any tests failed, with details about failures. |