Skip to content

Commit

Permalink
Add internal hidden rules for testing (#9747)
Browse files Browse the repository at this point in the history
Updated implementation of #7369
which was left out in the cold.

This was motivated again following changes in #9691 and #9689 where we
could not test the changes without actually deprecating or removing
rules.

---

Follow-up to discussion in #7210

Moves integration tests from using rules that are transitively in
nursery / preview groups to dedicated test rules that only exist during
development. These rules always raise violations (they do not require
specific file behavior). The rules are not available in production or in
the documentation.

Uses features instead of `cfg(test)` for cross-crate support per
rust-lang/cargo#8379
  • Loading branch information
zanieb authored Feb 1, 2024
1 parent 2cc8acb commit f18e7d4
Show file tree
Hide file tree
Showing 13 changed files with 541 additions and 196 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ jobs:
tool: cargo-insta
- uses: Swatinem/rust-cache@v2
- name: "Run tests"
run: cargo insta test --all --all-features --unreferenced reject
run: cargo insta test --all --exclude ruff_dev --all-features --unreferenced reject
- name: "Run dev tests"
# e.g. generating the schema — these should not run with all features enabled
run: cargo insta test -p ruff_dev --unreferenced reject
# Check for broken links in the documentation.
- run: cargo doc --all --no-deps
env:
Expand Down Expand Up @@ -146,7 +149,7 @@ jobs:
- name: "Run tests"
shell: bash
# We can't reject unreferenced snapshots on windows because flake8_executable can't run on windows
run: cargo insta test --all --all-features
run: cargo insta test --all --exclude ruff_dev --all-features

cargo-test-wasm:
name: "cargo test (wasm)"
Expand Down
2 changes: 2 additions & 0 deletions crates/ruff/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ walkdir = { workspace = true }
wild = { workspace = true }

[dev-dependencies]
# Enable test rules during development
ruff_linter = { path = "../ruff_linter", features = ["clap", "test-rules"] }
assert_cmd = { workspace = true }
# Avoid writing colored snapshots when running tests from the terminal
colored = { workspace = true, features = ["no-color"]}
Expand Down
Loading

0 comments on commit f18e7d4

Please sign in to comment.