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

feature: ignore outputs in trycmd, only check successful exit #374

Open
bryango opened this issue Dec 17, 2024 · 4 comments · May be fixed by #376
Open

feature: ignore outputs in trycmd, only check successful exit #374

bryango opened this issue Dec 17, 2024 · 4 comments · May be fixed by #376
Labels
A-trycmd Area: trycmd package

Comments

@bryango
Copy link

bryango commented Dec 17, 2024

This would be useful when dealing with non-reproducible commands (where the output may change frequently). In this case, checking against the output is unrealistic, but it is still useful to validate that e.g. all the examples in README run successfully.

Context: I am writing test cases for a web scraper.

@epage epage added the A-trycmd Area: trycmd package label Dec 17, 2024
@bryango bryango linked a pull request Jan 4, 2025 that will close this issue
@bryango
Copy link
Author

bryango commented Jan 10, 2025

A proposal: turn on the "check status only" mode through the env var TRYCMD=status. I've provided a quick realization of this proposal in #376 (pending discussions).

@epage
Copy link
Contributor

epage commented Jan 10, 2025

Can the output be made reproducible through redactions, including globs?

If the output shouldn't be checked, shouldn't that be a default state, rather than relying on an env variable to opt-out?

Are you wanting the ability to force an overwrite of the output?

@bryango
Copy link
Author

bryango commented Jan 10, 2025

If the output shouldn't be checked, shouldn't that be a default state, rather than relying on an env variable to opt-out?

Are you wanting the ability to force an overwrite of the output?

Yes precisely! I would like TRYCMD=status for continuous testing, but also TRYCMD=overwrite to update the snapshot once in a while.

For my specific use case: I would like CI to ensure that the examples in my README continue to run successfully, but also reserve the ability to update them one in a while. AFAIK trycmd is the only library that can do this to a README file magically.

Can the output be made reproducible through redactions, including globs?

I do use some redactions, but since it's a user facing README, too much redactions would lead to a poor demonstration of the program (a web scraper).

@epage
Copy link
Contributor

epage commented Jan 10, 2025

If we go forward with this, it seems like a state that should be put as a code fence attribute or in the trycmd API.

I have considered adding a "force update" value that would write output independent of test status. That seems like it'd be a good fit with this. The problem I've had is overwrite would be a good name for this (with the current behavior being update or bless) but I'm concerned about deviating from trybuild and the user disruption that renaming the standard value would have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-trycmd Area: trycmd package
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants