-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Ability to perform integration test on Jupyter notebooks #5076
Conversation
Current dependencies on/for this PR: This comment was auto-generated by Graphite. |
crates/ruff/src/jupyter/snapshots/ruff__jupyter__notebook__test__import_sorting.snap
Outdated
Show resolved
Hide resolved
crates/ruff/src/test.rs
Outdated
if let SourceKind::Jupyter(notebook) = source_kind { | ||
assert_eq!(notebook.cell_offsets(), expected_notebook.cell_offsets()); | ||
assert_eq!(notebook.index(), expected_notebook.index()); | ||
assert_eq!(notebook.content(), expected_notebook.content()); | ||
}; | ||
Ok(messages) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use snapshots as we'll be asserting the content here itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could move the assert_messages!(diagnostics);
here but it's fine either way
PR Check ResultsEcosystem✅ ecosystem check detected no changes. BenchmarkLinux
Windows
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
crates/ruff/src/test.rs
Outdated
if let SourceKind::Jupyter(notebook) = source_kind { | ||
assert_eq!(notebook.cell_offsets(), expected_notebook.cell_offsets()); | ||
assert_eq!(notebook.index(), expected_notebook.index()); | ||
assert_eq!(notebook.content(), expected_notebook.content()); | ||
}; | ||
Ok(messages) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could move the assert_messages!(diagnostics);
here but it's fine either way
} | ||
} | ||
|
||
pub(crate) fn print_jupyter_messages( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems a bit hacky to print cell information in the snapshot but just thought to put it out there to gain some feedback. The diff lines are also incorrect which should be fixed once the support is added.
We could just avoid creating snapshots and test out using assert_eq!
which is already being done for cell_offsets
, index
and content
.
For reference, this is the commit which is isolated to this change (f63103b)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i like it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I trust @konstin on this one, not gonna review closely ;)
I'll add some more tests now that we've the ability to do so! |
Summary
Ability to perform integration test on Jupyter notebooks
Part of #1218
Test Plan
cargo test