Skip to content

Embellish fixture asserts with the paths and carve out fixture support file.#217

Merged
jonasbardino merged 1 commit intonextfrom
test/fixture-show-paths-and-carve-out-as-support-file
Apr 4, 2025
Merged

Embellish fixture asserts with the paths and carve out fixture support file.#217
jonasbardino merged 1 commit intonextfrom
test/fixture-show-paths-and-carve-out-as-support-file

Conversation

@albu-diku
Copy link
Copy Markdown
Contributor

@albu-diku albu-diku commented Mar 25, 2025

It was pointed out that assertions against snapshots was an odd-one-out with respect to the emphasis on helpful information in the face a test failure that we usually strive for. Specifically, we had not arrange the developer being told which fixture was failing its tests.

The reason for this was the fixture code had been written as grab fixture data via path then do whatever comparison as desired as opposed to exposing a compound assertion that would take a fixture file path and value and do an equality check - this formulation would have access to the path for display at the point the equality fails. Note we trade assertion flexibility for output quality but fixtures are almost always going to be an equality so not a problem.

Ride on the coattails of adding the abstraction and place all the fixture support code in its own separate support file whcih happens to follow a growing and healthy convention in the tree.

@albu-diku albu-diku changed the title Embellish fixture assertions with the path and carve out fixture supp… Embellish fixture asserts with the paths and carve out fixture support file. Mar 25, 2025
Copy link
Copy Markdown
Contributor

@jonasbardino jonasbardino left a comment

Choose a reason for hiding this comment

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

Thanks, generally looks good and valuable.

Could you please have another look at especially the new fixturesupp module, which could use some polish before merge?
Copyright header, missing docstrings and such classics.

@jonasbardino jonasbardino self-assigned this Mar 27, 2025
@jonasbardino jonasbardino added the test-only Improvements or additions solely for better test coverage - without functionality changes label Mar 27, 2025
@albu-diku
Copy link
Copy Markdown
Contributor Author

The code you're commenting on was mostly just moved. I'm also not really sure why a missing header was called out was mentioned when I had included one in the new fixturesupp file.

This was meant to be a really quick change to take care of your request to include the path in the assertion message. Have pushed a version without moving anything and a docstrings on anything in these changes.

@albu-diku albu-diku force-pushed the test/fixture-show-paths-and-carve-out-as-support-file branch from 569a535 to 34c51f7 Compare April 4, 2025 10:19
@albu-diku albu-diku force-pushed the test/fixture-show-paths-and-carve-out-as-support-file branch from 34c51f7 to 8d090b8 Compare April 4, 2025 11:04
@jonasbardino
Copy link
Copy Markdown
Contributor

The moved code came with a clearly copy/pasted copyright header that needed adjustment to the new module name and year in tests/support/fixturesupp.py . That's all I meant.

I did not check which functions just moved, but noted the missing docstrings when they showed in the diff.
It's not that a move triggers any special rules, but as you know we generally want docstrings in anything but trivial functions.
If you use an IDE I'm sure you can even tell it to automatically insert a placeholder in every new class and function you make, to remind you to type a line or two 🤓

Anyway, thanks for helping out, and I'll see if I can this smaller version merged now.

@jonasbardino jonasbardino merged commit 0448427 into next Apr 4, 2025
6 of 7 checks passed
@jonasbardino jonasbardino deleted the test/fixture-show-paths-and-carve-out-as-support-file branch April 4, 2025 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test-only Improvements or additions solely for better test coverage - without functionality changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants