Skip to content

Conversation

@Peter554
Copy link
Collaborator

Cherry-picked from #222

This snapshot test captures the results of import scanning against real packages. This gives us a lot of confidence when refactoring the import scanning code (helpful as we move more of this code over to rust).

The snapshot test uses the popular syrupy1 pytest plugin.

Footnotes

  1. https://github.com/syrupy-project/syrupy

@codspeed-hq
Copy link

codspeed-hq bot commented Jun 16, 2025

CodSpeed Instrumentation Performance Report

Merging #224 will not alter performance

Comparing Peter554:snapshot-test-import-scanning (6cd4a6f) with master (1d56065)

Summary

✅ 22 untouched benchmarks

@Peter554 Peter554 force-pushed the snapshot-test-import-scanning branch 2 times, most recently from 9769927 to 7bf6e65 Compare June 16, 2025 16:13
This snapshot test captures the results of import scanning
against real packages. This gives us a lot of confidence
when refactoring the import scanning code (helpful as we move more
of this code over to rust).

The snapshot test uses the popular syrupy[^1] pytest plugin.

[^1]: https://github.com/syrupy-project/syrupy
@Peter554 Peter554 force-pushed the snapshot-test-import-scanning branch from 7bf6e65 to 6cd4a6f Compare June 17, 2025 04:41
grimp.build_graph(package_name, cache_dir=None)
def test_build_graph_on_real_package(package_name, snapshot):
graph = grimp.build_graph(package_name, cache_dir=None)
imports = graph.find_matching_direct_imports(import_expression="** -> **")
Copy link
Collaborator Author

@Peter554 Peter554 Jun 17, 2025

Choose a reason for hiding this comment

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

🧀 This gets all the imports in a flat list (results are sorted, so stable)

@seddonym seddonym merged commit 8a413e4 into python-grimp:master Jun 17, 2025
18 checks passed
@seddonym
Copy link
Collaborator

Thanks, I like it!

@Peter554 Peter554 deleted the snapshot-test-import-scanning branch June 17, 2025 11:12
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.

2 participants