Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove cyclic dev dependency with the parser crate #11261

Merged
merged 4 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion crates/ruff_python_ast/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ serde = { workspace = true, optional = true }

[dev-dependencies]
insta = { workspace = true }
ruff_python_parser = { path = "../ruff_python_parser" }

[features]
serde = ["dep:serde", "ruff_text_size/serde"]
Expand Down
23 changes: 23 additions & 0 deletions crates/ruff_python_ast_integration_tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "ruff_python_ast_integration_tests"
version = "0.0.0"
edition.workspace = true
rust-version.workspace = true
homepage.workspace = true
documentation.workspace = true
repository.workspace = true
authors.workspace = true
license.workspace = true

[dependencies]

[dev-dependencies]
ruff_python_parser = { path = "../ruff_python_parser" }
ruff_python_ast = { path = "../ruff_python_ast" }
ruff_python_trivia = { path = "../ruff_python_trivia" }
ruff_text_size = { path = "../ruff_text_size" }

insta = { workspace = true }

[lints]
workspace = true
13 changes: 13 additions & 0 deletions crates/ruff_python_ast_integration_tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Integration tests for `ruff_python_ast`

This crate includes integration tests for the `ruff_python_ast` crate.

The reason for having a separate crate is to avoid introducing a dev circular
dependency between the `ruff_python_parser` crate and the `ruff_python_ast` crate.

This crate shouldn't include any code, only tests.

**Reference:**

- `rust-analyzer` issue: <https://github.com/rust-lang/rust-analyzer/issues/3390>
- Ruff's pull request: <https://github.com/astral-sh/ruff/pull/11261>
1 change: 1 addition & 0 deletions crates/ruff_python_ast_integration_tests/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use ruff_python_ast::identifier;
use ruff_python_parser::{parse_suite, ParseError};
use ruff_text_size::{TextRange, TextSize};

use ruff_python_ast::identifier;

#[test]
fn extract_else_range() -> Result<(), ParseError> {
let contents = r"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: crates/ruff_python_ast/tests/preorder.rs
source: crates/ruff_python_ast_integration_tests/tests/preorder.rs
expression: trace
---
- ModModule
Expand All @@ -8,4 +8,3 @@ expression: trace
- BytesLiteral
- BytesLiteral
- BytesLiteral

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: crates/ruff_python_ast/tests/preorder.rs
source: crates/ruff_python_ast_integration_tests/tests/preorder.rs
expression: trace
---
- ModModule
Expand All @@ -12,4 +12,3 @@ expression: trace
- TypeParamParamSpec
- StmtExpr
- ExprEllipsisLiteral

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: crates/ruff_python_ast/tests/preorder.rs
source: crates/ruff_python_ast_integration_tests/tests/preorder.rs
expression: trace
---
- ModModule
Expand All @@ -10,4 +10,3 @@ expression: trace
- ExprName
- Lt
- ExprNumberLiteral

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: crates/ruff_python_ast/tests/preorder.rs
source: crates/ruff_python_ast_integration_tests/tests/preorder.rs
expression: trace
---
- ModModule
Expand All @@ -12,4 +12,3 @@ expression: trace
- Decorator
- ExprName
- StmtPass

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: crates/ruff_python_ast/tests/preorder.rs
source: crates/ruff_python_ast_integration_tests/tests/preorder.rs
expression: trace
---
- ModModule
Expand All @@ -13,4 +13,3 @@ expression: trace
- Comprehension
- ExprName
- ExprName

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: crates/ruff_python_ast/tests/preorder.rs
source: crates/ruff_python_ast_integration_tests/tests/preorder.rs
expression: trace
---
- ModModule
Expand All @@ -15,4 +15,3 @@ expression: trace
- ExprName
- FStringLiteralElement
- FStringLiteralElement

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: crates/ruff_python_ast/tests/preorder.rs
source: crates/ruff_python_ast_integration_tests/tests/preorder.rs
expression: trace
---
- ModModule
Expand All @@ -23,4 +23,3 @@ expression: trace
- ExprNumberLiteral
- Parameter
- StmtPass

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: crates/ruff_python_ast/tests/preorder.rs
source: crates/ruff_python_ast_integration_tests/tests/preorder.rs
expression: trace
---
- ModModule
Expand All @@ -15,4 +15,3 @@ expression: trace
- ExprNumberLiteral
- Parameter
- StmtPass

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: crates/ruff_python_ast/tests/preorder.rs
source: crates/ruff_python_ast_integration_tests/tests/preorder.rs
expression: trace
---
- ModModule
Expand All @@ -13,4 +13,3 @@ expression: trace
- Parameters
- StmtExpr
- ExprEllipsisLiteral

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: crates/ruff_python_ast/tests/preorder.rs
source: crates/ruff_python_ast_integration_tests/tests/preorder.rs
expression: trace
---
- ModModule
Expand All @@ -9,4 +9,3 @@ expression: trace
- Comprehension
- ExprName
- ExprName

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: crates/ruff_python_ast/tests/preorder.rs
source: crates/ruff_python_ast_integration_tests/tests/preorder.rs
expression: trace
---
- ModModule
Expand Down Expand Up @@ -30,4 +30,3 @@ expression: trace
- ExprNumberLiteral
- StmtExpr
- ExprEllipsisLiteral

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: crates/ruff_python_ast/tests/preorder.rs
source: crates/ruff_python_ast_integration_tests/tests/preorder.rs
expression: trace
---
- ModModule
Expand All @@ -9,4 +9,3 @@ expression: trace
- Comprehension
- ExprName
- ExprName

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: crates/ruff_python_ast/tests/preorder.rs
source: crates/ruff_python_ast_integration_tests/tests/preorder.rs
expression: trace
---
- ModModule
Expand All @@ -8,4 +8,3 @@ expression: trace
- StringLiteral
- StringLiteral
- StringLiteral

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: crates/ruff_python_ast/tests/preorder.rs
source: crates/ruff_python_ast_integration_tests/tests/preorder.rs
expression: trace
---
- ModModule
Expand All @@ -14,4 +14,3 @@ expression: trace
- ExprSubscript
- ExprName
- ExprName

Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
source: crates/ruff_python_ast/tests/visitor.rs
source: crates/ruff_python_ast_integration_tests/tests/visitor.rs
expression: trace
---
- StmtExpr
- ExprBytesLiteral
- BytesLiteral
- BytesLiteral
- BytesLiteral

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: crates/ruff_python_ast/tests/visitor.rs
source: crates/ruff_python_ast_integration_tests/tests/visitor.rs
expression: trace
---
- StmtClassDef
Expand All @@ -10,4 +10,3 @@ expression: trace
- TypeParamParamSpec
- StmtExpr
- ExprEllipsisLiteral

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: crates/ruff_python_ast/tests/visitor.rs
source: crates/ruff_python_ast_integration_tests/tests/visitor.rs
expression: trace
---
- StmtExpr
Expand All @@ -9,4 +9,3 @@ expression: trace
- Lt
- ExprName
- ExprNumberLiteral

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: crates/ruff_python_ast/tests/visitor.rs
source: crates/ruff_python_ast_integration_tests/tests/visitor.rs
expression: trace
---
- StmtFunctionDef
Expand All @@ -9,4 +9,3 @@ expression: trace
- StmtClassDef
- ExprName
- StmtPass

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: crates/ruff_python_ast/tests/visitor.rs
source: crates/ruff_python_ast_integration_tests/tests/visitor.rs
expression: trace
---
- StmtExpr
Expand All @@ -12,4 +12,3 @@ expression: trace
- ExprName
- Pow
- ExprNumberLiteral

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: crates/ruff_python_ast/tests/visitor.rs
source: crates/ruff_python_ast_integration_tests/tests/visitor.rs
expression: trace
---
- StmtExpr
Expand All @@ -14,4 +14,3 @@ expression: trace
- ExprName
- FStringLiteralElement
- FStringLiteralElement

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: crates/ruff_python_ast/tests/visitor.rs
source: crates/ruff_python_ast_integration_tests/tests/visitor.rs
expression: trace
---
- StmtFunctionDef
Expand All @@ -16,4 +16,3 @@ expression: trace
- Parameter
- Parameter
- StmtPass

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: crates/ruff_python_ast/tests/visitor.rs
source: crates/ruff_python_ast_integration_tests/tests/visitor.rs
expression: trace
---
- StmtFunctionDef
Expand All @@ -11,4 +11,3 @@ expression: trace
- Parameter
- Parameter
- StmtPass

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: crates/ruff_python_ast/tests/visitor.rs
source: crates/ruff_python_ast_integration_tests/tests/visitor.rs
expression: trace
---
- StmtFunctionDef
Expand All @@ -11,4 +11,3 @@ expression: trace
- Parameters
- StmtExpr
- ExprEllipsisLiteral

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
source: crates/ruff_python_ast/tests/visitor.rs
source: crates/ruff_python_ast_integration_tests/tests/visitor.rs
expression: trace
---
- StmtExpr
Expand All @@ -8,4 +8,3 @@ expression: trace
- ExprName
- ExprName
- ExprName

Loading
Loading