Content hashes and the pass cache¶
A test's pass is cached under its own content hash and the content hash of the code it tests; neither includes the other.
cache
¶
Content hashes of tests and of the code they test, and the pass cache.
The code a test checks is identified by its content: code_digest is the
module digest of module_hashes
over the checked module's own declarations, which is invariant under
renaming, reordering, and reformatting, and never includes a test (tests are
not part of Module.statements, and the computations the runner adds to
type a property's variables are left out). A test is identified by its own
content: declaration_digest hashes a test declaration's structure, its
source positions excluded, under the same digest
(tagged_digest). Editing a test
thus leaves the code's hash unchanged, and editing the code leaves every
test's hash unchanged.
ResultCache remembers each pass under the pair of hashes and the test's
settings: a test whose content, code, and settings are unchanged since it
last passed is not run again. A failure is never cached.
RUNNER_PREFIX
module-attribute
¶
The name prefix of the computations the runner adds to a checked module to type a property's variables.
CACHE_REVISION
module-attribute
¶
The revision of the runner's semantics; a cached pass from another is not trusted.
ResultCache
¶
Passes remembered by content hash, one small file per pass.
| PARAMETER | DESCRIPTION |
|---|---|
root
|
The directory;
TYPE:
|
Source code in src/quivers/testing/cache.py
passed
¶
Whether this test passed against this code with these settings.
| PARAMETER | DESCRIPTION |
|---|---|
test
|
The test's hash.
TYPE:
|
module
|
The code's hash.
TYPE:
|
settings
|
The test's settings, serialized.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
Whether a pass is recorded. |
Source code in src/quivers/testing/cache.py
record
¶
Remember a pass.
| PARAMETER | DESCRIPTION |
|---|---|
test
|
The test's hash.
TYPE:
|
module
|
The code's hash.
TYPE:
|
settings
|
The test's settings, serialized.
TYPE:
|
Source code in src/quivers/testing/cache.py
declaration_digest
¶
declaration_digest(test: TestDecl) -> str
The content hash of one test declaration.
| PARAMETER | DESCRIPTION |
|---|---|
test
|
The declaration.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The digest of its kind, title, body, variables, options, subject and doc comment, its source positions excluded. |
Source code in src/quivers/testing/cache.py
code_digest
¶
code_digest(module: QiecModule) -> str
The content hash of a checked module's code.
| PARAMETER | DESCRIPTION |
|---|---|
module
|
The checked module, possibly with the runner's binder computations.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The digest of the multiset of its declarations' kinds and content hashes, the runner's computations left out. |