Skip to content

Conversation

@neilmayhew
Copy link
Contributor

@neilmayhew neilmayhew commented Oct 23, 2025

Description

cardano-ledger-test was using a mixture of hspec and tasty which made it impossible to provide command line options. The mostly mechanical changes converts all the tasty tests to hspec ones, since we prefer hspec to tasty.

In addition, as a stopgap, I've created a small library called tasty-compat that provides the Tasty modules, types and functions used by Ledger, using the functionality of Hspec. It's a drop-in replacement for Tasty, just by changing the build-depends from tasty to tasty-compat.

I haven't made it work for Byron, because the test code there uses some advanced features of Tasty, but it's eliminated Tasty everywhere else in Ledger. Now we can use Hspec command-line options with every test executable except the three in Byron.

Checklist

  • Commits in meaningful sequence and with useful messages.
  • Tests added or updated when needed.
  • CHANGELOG.md files updated for packages with externally visible changes.
    NOTE: New section is never added with the code changes. (See RELEASING.md).
  • Versions updated in .cabal and CHANGELOG.md files when necessary, according to the
    versioning process.
  • Version bounds in .cabal files updated when necessary.
    NOTE: If bounds change in a cabal file, that package itself must have a version increase. (See RELEASING.md).
  • Code formatted (use scripts/fourmolize.sh).
  • Cabal files formatted (use scripts/cabal-format.sh).
  • CDDL files are up to date (use scripts/gen-cddl.sh)
  • hie.yaml updated (use scripts/gen-hie.sh).
  • Self-reviewed the diff.

@neilmayhew neilmayhew requested a review from a team as a code owner October 23, 2025 00:27
@neilmayhew neilmayhew force-pushed the nm/eliminate-tasty branch 2 times, most recently from ff6ae4f to e0cf267 Compare October 23, 2025 04:21
Copy link
Contributor

@teodanciu teodanciu 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 to me - I also compared these test logs with ones from before the refactoring, and indeed, all tests are being ran and the nesting is the same.

Thanks for finding and implementing the right solution (instead of my suggested tasty-hspec workaround!)
I guess this supersedes #5349, so we can close it probably.

Copy link
Contributor

@aniketd aniketd left a comment

Choose a reason for hiding this comment

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

Thank you! 🙌

@neilmayhew neilmayhew changed the title Remove tasty from cardano-ledger-test Remove tasty from all test suites except those in Byron Oct 23, 2025
@neilmayhew neilmayhew force-pushed the nm/eliminate-tasty branch 2 times, most recently from 47fec54 to 575352f Compare October 23, 2025 17:17
@neilmayhew
Copy link
Contributor Author

I also compared these test logs with ones from before the refactoring, and indeed, all tests are being ran and the nesting is the same.

Thanks for doing that!

Copy link
Collaborator

@lehins lehins left a comment

Choose a reason for hiding this comment

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

It really makes me happy to see reduction of tasty usage! Thank you for doing this

@neilmayhew neilmayhew force-pushed the nm/eliminate-tasty branch 2 times, most recently from d8da038 to 1c4be94 Compare October 24, 2025 13:50
@neilmayhew
Copy link
Contributor Author

I made quite a few changes, mostly as a result of the first one:

  • Make tasty-compat a sublib of cardano-ledger-core
  • Remove tasty manually from:
    • cardano-ledger-alonzo-test
    • cardano-ledger-binary
    • cardano-ledger-test
    • set-algebra
    • small-steps
    • vector-map

cardano-ledger-binary, set-algebra, small-steps, vector-map are dependencies of cardano-ledger-core and so can't use its tasty-compat sublibrary because that would create a circular dependency.

Copy link
Collaborator

@lehins lehins left a comment

Choose a reason for hiding this comment

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

Awesome!!! Thank you!

@lehins lehins enabled auto-merge October 24, 2025 18:30
@lehins lehins force-pushed the nm/eliminate-tasty branch from 82f9203 to ad35b4e Compare October 24, 2025 19:04
@lehins lehins merged commit 6c33dc1 into master Oct 24, 2025
122 checks passed
@lehins lehins deleted the nm/eliminate-tasty branch October 24, 2025 22:06
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.

5 participants