Skip to content

Commit f18e7d4

Browse files
authored
Add internal hidden rules for testing (#9747)
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
1 parent 2cc8acb commit f18e7d4

File tree

13 files changed

+541
-196
lines changed

13 files changed

+541
-196
lines changed

.github/workflows/ci.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ jobs:
117117
tool: cargo-insta
118118
- uses: Swatinem/rust-cache@v2
119119
- name: "Run tests"
120-
run: cargo insta test --all --all-features --unreferenced reject
120+
run: cargo insta test --all --exclude ruff_dev --all-features --unreferenced reject
121+
- name: "Run dev tests"
122+
# e.g. generating the schema — these should not run with all features enabled
123+
run: cargo insta test -p ruff_dev --unreferenced reject
121124
# Check for broken links in the documentation.
122125
- run: cargo doc --all --no-deps
123126
env:
@@ -146,7 +149,7 @@ jobs:
146149
- name: "Run tests"
147150
shell: bash
148151
# We can't reject unreferenced snapshots on windows because flake8_executable can't run on windows
149-
run: cargo insta test --all --all-features
152+
run: cargo insta test --all --exclude ruff_dev --all-features
150153

151154
cargo-test-wasm:
152155
name: "cargo test (wasm)"

crates/ruff/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ walkdir = { workspace = true }
5454
wild = { workspace = true }
5555

5656
[dev-dependencies]
57+
# Enable test rules during development
58+
ruff_linter = { path = "../ruff_linter", features = ["clap", "test-rules"] }
5759
assert_cmd = { workspace = true }
5860
# Avoid writing colored snapshots when running tests from the terminal
5961
colored = { workspace = true, features = ["no-color"]}

0 commit comments

Comments
 (0)