Repository navigation
feat(test): select unit tests by name and require unique test names - #989
Merged
Merged
Conversation
Unit-test names (TEST name or file stem) and scenario names now join the global resource-name rule with models, sources, seeds, functions, Python nodes, providers and hooks. A clash is a compile error naming both kinds and files; cases of one parameterized test share its name. Fixtures that named a test or scenario after its model are renamed.
sqb test and sqb build accept a unit-test name, bare or as test:<name>, with glob patterns. Test selectors union with resource selectors, --case still narrows, and selecting only tests runs them without building models. Every other command rejects unit-test selectors with S013, and unknown names suggest the closest selectable names.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Unit tests could only be selected through the models they read, so running one test meant building and testing its whole model scope. Test and scenario names could also collide with models and other resources, which makes a name-based selector ambiguous.
Changes
sqb testandsqb buildaccepttest:<name>, or a bare name that matches no other resource, with glob patterns. Test selectors union with resource selectors and--casestill narrows. Selecting only tests runs them without building models, and the defer-clone prephase is skipped.+or,on a unit-test selector also raises S013.--selectvalues keep their old meaning and select nothing.Verification
make test(11031 passed).sqb testand scenario directories, selector surface, unused-CTE rules and Dagster selection parity. New E2E cases cover selection by name, duplicate names and empty--selectvalues; the empty-value cases fail on the previous head.fensu check,make check-ciand the hygiene scan.