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

Ability to perform integration test on Jupyter notebooks #5076

Merged
merged 4 commits into from
Jun 15, 2023

Conversation

dhruvmanila
Copy link
Member

Summary

Ability to perform integration test on Jupyter notebooks

Part of #1218

Test Plan

cargo test

@dhruvmanila
Copy link
Member Author

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

Comment on lines 66 to 71
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)
Copy link
Member Author

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?

Copy link
Member

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

@github-actions
Copy link
Contributor

github-actions bot commented Jun 14, 2023

PR Check Results

Ecosystem

✅ ecosystem check detected no changes.

Benchmark

Linux

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.00      7.2±0.43ms     5.6 MB/sec    1.02      7.4±0.37ms     5.5 MB/sec
formatter/numpy/ctypeslib.py               1.00  1550.4±94.02µs    10.7 MB/sec    1.02  1578.8±68.36µs    10.5 MB/sec
formatter/numpy/globals.py                 1.00   152.1±10.60µs    19.4 MB/sec    1.02    155.5±9.85µs    19.0 MB/sec
formatter/pydantic/types.py                1.04      3.2±0.17ms     8.1 MB/sec    1.00      3.0±0.19ms     8.4 MB/sec
linter/all-rules/large/dataset.py          1.00     16.3±1.00ms     2.5 MB/sec    1.00     16.2±0.72ms     2.5 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      3.7±0.20ms     4.4 MB/sec    1.03      3.8±0.17ms     4.3 MB/sec
linter/all-rules/numpy/globals.py          1.00   476.0±26.55µs     6.2 MB/sec    1.04   495.1±29.01µs     6.0 MB/sec
linter/all-rules/pydantic/types.py         1.02      6.8±0.36ms     3.8 MB/sec    1.00      6.7±0.26ms     3.8 MB/sec
linter/default-rules/large/dataset.py      1.02      7.9±0.40ms     5.1 MB/sec    1.00      7.8±0.37ms     5.2 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00  1683.5±86.41µs     9.9 MB/sec    1.00  1689.4±87.34µs     9.9 MB/sec
linter/default-rules/numpy/globals.py      1.02    199.3±8.77µs    14.8 MB/sec    1.00    196.1±9.63µs    15.1 MB/sec
linter/default-rules/pydantic/types.py     1.08      3.9±0.25ms     6.5 MB/sec    1.00      3.6±0.17ms     7.1 MB/sec

Windows

group                                      main                                   pr
-----                                      ----                                   --
formatter/large/dataset.py                 1.00      9.6±0.36ms     4.2 MB/sec    1.03      9.9±0.43ms     4.1 MB/sec
formatter/numpy/ctypeslib.py               1.00      2.0±0.14ms     8.3 MB/sec    1.01      2.0±0.11ms     8.2 MB/sec
formatter/numpy/globals.py                 1.00   191.0±13.93µs    15.4 MB/sec    1.02   194.2±13.04µs    15.2 MB/sec
formatter/pydantic/types.py                1.00      4.0±0.19ms     6.5 MB/sec    1.04      4.1±0.31ms     6.2 MB/sec
linter/all-rules/large/dataset.py          1.00     21.1±0.84ms  1975.3 KB/sec    1.00     21.1±0.73ms  1972.0 KB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      5.3±0.21ms     3.2 MB/sec    1.00      5.2±0.23ms     3.2 MB/sec
linter/all-rules/numpy/globals.py          1.00   627.3±36.10µs     4.7 MB/sec    1.00   629.4±39.82µs     4.7 MB/sec
linter/all-rules/pydantic/types.py         1.00      9.0±0.41ms     2.8 MB/sec    1.02      9.2±0.68ms     2.8 MB/sec
linter/default-rules/large/dataset.py      1.00     10.4±0.35ms     3.9 MB/sec    1.02     10.6±0.40ms     3.8 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.01      2.2±0.11ms     7.5 MB/sec    1.00      2.2±0.12ms     7.5 MB/sec
linter/default-rules/numpy/globals.py      1.01   253.7±14.61µs    11.6 MB/sec    1.00   251.5±15.96µs    11.7 MB/sec
linter/default-rules/pydantic/types.py     1.00      4.7±0.21ms     5.4 MB/sec    1.03      4.9±0.33ms     5.2 MB/sec

Copy link
Member

@konstin konstin left a comment

Choose a reason for hiding this comment

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

Looks good!

Comment on lines 66 to 71
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)
Copy link
Member

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

@dhruvmanila dhruvmanila marked this pull request as ready for review June 14, 2023 17:44
}
}

pub(crate) fn print_jupyter_messages(
Copy link
Member Author

@dhruvmanila dhruvmanila Jun 14, 2023

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)

\cc @charliermarsh @konstin

Copy link
Member

Choose a reason for hiding this comment

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

i like it!

Copy link
Member

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 ;)

@dhruvmanila dhruvmanila merged commit 097823b into main Jun 15, 2023
@dhruvmanila dhruvmanila deleted the dhruv/jupyter-integration-test branch June 15, 2023 02:34
@dhruvmanila
Copy link
Member Author

I'll add some more tests now that we've the ability to do so!

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.

3 participants