FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Adding in NoMissingUnitTest linter rule by cmgoffena13 · Pull Request #5294 · SQLMesh/sqlmesh · GitHub

Repository navigation

Adding in NoMissingUnitTest linter rule - #5294

Merged
georgesittas merged 10 commits into
SQLMesh:mainfrom
cmgoffena13:add-linter-rule
Dec 2, 2025
Merged

georgesittas merged 10 commits into
SQLMesh:mainfrom
cmgoffena13:add-linter-rule

Conversation

cmgoffena13 commented Sep 4, 2025 •
edited
Loading

Copy link
Copy Markdown
Collaborator

I'm having trouble fleshing out the test due to the path having to point to the example project. Since I have to trigger the pytest from the root it is trying to find the /tests directory in the root rather than the example project root. Any help on resolving the path issue would be appreciated so I can finish the test. (EDIT: Figured out how to switch the contexts, let me know if there's anything that needs adjustment!)

CLAassistant commented Sep 4, 2025 •
edited
Loading

Copy link
Copy Markdown


All committers have signed the CLA.

Comment thread sqlmesh/core/linter/rules/builtin.py Outdated

Copy link
Copy Markdown
Collaborator Author

@VaggelisD @georgesittas - alright, took my first swing at it if either of you want to take a look.

  1. Added in a property method to ModelTestMetadata to get model_name from the body easily
  2. Added model_test_metadata and models_with_tests to be added when a project loads so a Set of model names is only calculated once upon load.
  3. Added self._model_test_metadata and self._models_with_tests to the context and Context::load() brings it in from loaded projects.
  4. Made sure the Context::test() utilizes the eagerly loaded test metadata instead of lazily loading it again

I did surface models_with_tests as a property in the Context to access for the linter rule.

Let me know if you want me to change anything!

Comment thread sqlmesh/core/test/discovery.py Outdated
Comment thread sqlmesh/core/loader.py Outdated
Comment thread sqlmesh/core/context.py Outdated

georgesittas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Btw, let's make sure that we track calls to load_model_tests and refactor as needed. For example, in magics.py, I think we should be able to skip that call since we already have the loaded context which contains all tests. Another example is in lsp/context.py.

Comment thread sqlmesh/core/context.py Outdated

Copy link
Copy Markdown
Collaborator

Thanks for addressing the comments @cmgoffena13. I'll take another look soon.

Copy link
Copy Markdown
Collaborator Author

@georgesittas - bumping this now that we're past the first round of holidays

georgesittas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks @cmgoffena13, I'll get this in and see if I can slightly refactor by removing / compacting some of the new context attributes.

georgesittas merged commit 5c51f1a into SQLMesh:main Dec 2, 2025
31 of 32 checks passed
scottypate added a commit to scottypate/sqlmesh that referenced this pull request May 18, 2026
* Fix(table_diff): Widen the data types that --decimals applies to (SQLMesh#5542)

* linting and style changes

* fix: dbt as_bool and as_number filters should return their original input values (SQLMesh#5532)

* fix: include schema temp table (SQLMesh#5545)

* Fix: Respect mssql_merge_exists flag and use merge as a strategy (SQLMesh#5544)

* fix: ensure _get_data_objects respects snapshots with different schemas (SQLMesh#5515)

Co-authored-by: Themis Valtinos <73662635+themisvaltinos@users.noreply.github.com>

* Fix: Add dbt-core 1.2.0 support (SQLMesh#5547)

* Fix: do not reduce empty generator when evaluating snapshots (SQLMesh#5548)

* Fix: Unexpected backfill of a parent when an interval outside the parent's range is restated for a child (SQLMesh#5551)

* Chore!: bump sqlglotrs to 27.28.0 (SQLMesh#5556)

* Feat: Check freshness for mixed external & sqlmesh models (SQLMesh#5499)

* Fix: create_test error with query and CTEs included (SQLMesh#5559)

* Fix: Incorrect treatment of the model's table as missing when processing batches with index > 0 (SQLMesh#5560)

* Fix: Only selected models need to be promoted when --inlclude-unmodified flag is provided (SQLMesh#5561)

* fix: added missing execution_time param for CLI audit command (SQLMesh#5563)

* Fix: Cache upstream dependencies when building the evaluation DAG in scheduler (SQLMesh#5569)

* Fix: Temporary disable lsp benchmarks

* Fix: Make macro evaluator locals available from macro calls in jinja (SQLMesh#5568)

* Fix: Require the cache for upstream deps in the scheduler (SQLMesh#5571)

* Fix: always sort Python model dfs in unit tests (SQLMesh#5575)

* ci: fix benchmark running (SQLMesh#5570)

* Feat: use proper `MERGE` statement for Fabric instead of the logical equivalent (SQLMesh#5586)

* Fix: Support of the null meta config in dbt model / source definitions (SQLMesh#5598)

* Docs: Fix set `invalidate_hard_deletes` default to `False` in SCD Type 2 models (SQLMesh#5596)

* Feat: NoMissingUnitTest linter rule (SQLMesh#5294)

* Fix: Include column types in Databricks materialized views with comments (SQLMesh#5578)

* fix(fabric): Alter table workaround (SQLMesh#5511)

Co-authored-by: Toby Mao <toby.mao@gmail.com>

* Chore(deps): Bump actions/setup-python from 5 to 6 (SQLMesh#5322)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Chore(deps): Bump astral-sh/setup-uv from 6 to 7 (SQLMesh#5537)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Chore(deps): Bump actions/setup-node from 4 to 6 (SQLMesh#5553)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Chore!: clean up unit test selection (SQLMesh#5615)

* Feat: add support for METADATA_SCHEMA in ducklake config.yml (SQLMesh#5616)

* Chore(deps): Bump actions/upload-artifact from 4 to 5 (SQLMesh#5564)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix(databricks): Add column type only along materialized view comments (SQLMesh#5617)

* Fix: Embedded Model Type Should Not Accept Any Audit (SQLMesh#5577)

Co-authored-by: Jo <46752250+georgesittas@users.noreply.github.com>

* fix: CI/CD Bot exit early before applying plan on unmergeable PR (SQLMesh#5590)

* Chore: Disable snowflake tests temporarily (SQLMesh#5620)

* Fix: Use categorization config in cicd bot environment summary (SQLMesh#5622)

* Fix: Include staged changes in the git selector (SQLMesh#5624)

* chore: remove dbt from sqlmesh tests package (SQLMesh#5626)

* fix: set `ExternalModel`'s default `kind` to `ExternalKind()` (SQLMesh#5634)

* Feat(trino): Introduce custom timestamp type mapping (SQLMesh#5635)

* Chore: Update type annotation for pandas and pandas-stubs >= v2.3.3 (SQLMesh#5637)

* Fix bigquery cli engine config test

* Update naming conventions and how to set the property

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Erin Drummond <erin.dru@gmail.com>
Co-authored-by: David Dai <ddai@tobikodata.com>
Co-authored-by: Ryan Eakman <6326532+eakmanrq@users.noreply.github.com>
Co-authored-by: Themis Valtinos <73662635+themisvaltinos@users.noreply.github.com>
Co-authored-by: Alexander Butler <41213451+z3z1ma@users.noreply.github.com>
Co-authored-by: Chris Rericha <67359577+crericha@users.noreply.github.com>
Co-authored-by: Jo <46752250+georgesittas@users.noreply.github.com>
Co-authored-by: Iaroslav Zeigerman <zeigerman.ia@gmail.com>
Co-authored-by: Vaggelis Danias <daniasevangelos@gmail.com>
Co-authored-by: Trey Spiller <1831878+treysp@users.noreply.github.com>
Co-authored-by: Anatoli Makarevich <makaroni4@gmail.com>
Co-authored-by: Ben <9087625+benfdking@users.noreply.github.com>
Co-authored-by: Mattias Thalén <bitter-polders0x@icloud.com>
Co-authored-by: Nick Nowicki <35818104+nnowicki@users.noreply.github.com>
Co-authored-by: Cortland Goffena <30168413+cmgoffena13@users.noreply.github.com>
Co-authored-by: Andreas Fred-Ojala <andreasfo@gmail.com>
Co-authored-by: Andreas <65893109+fresioAS@users.noreply.github.com>
Co-authored-by: Toby Mao <toby.mao@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: bearInTheRoad <60107263+bearInTheRoad@users.noreply.github.com>
Co-authored-by: Brian Crant <17074379+bcrant@users.noreply.github.com>
Co-authored-by: etonlels <etonlels@gmail.com>
Co-authored-by: Vincent Chan <vchan@users.noreply.github.com>
fresioAS pushed a commit to fresioAS/sqlmesh that referenced this pull request May 31, 2026
Signed-off-by: fresioAS <andreas.fredhoi@three60energy.com>
fresioAS pushed a commit to fresioAS/sqlmesh that referenced this pull request Jul 13, 2026
Signed-off-by: fresioAS <andreas.fredhoi@three60energy.com>
cmgoffena13 deleted the add-linter-rule branch August 29, 2026 23:33
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL