trycmd icon indicating copy to clipboard operation
trycmd copied to clipboard

bin not found causes "ignored" not an error

Open sourcefrog opened this issue 2 years ago • 8 comments

In trying to set up trycmd I had this md file:

```trycmd
$ cargo mutants --help
```

This gives a result of ignored.

With --nocapture I could find out:

running 1 test
[              trycmd::runner] 	Substitutions { vars: {"[CWD]": "/home/mbp/src/mutants"}, unused: {"[EXE]"} }
[              trycmd::runner] 	bin="cargo" not found
[              trycmd::runner] 	Case: Ok(
    Output {
        path: "trycmd/hello.trycmd",
        id: Some(
            "4",
        ),
        spawn: Spawn {
            exit: None,
            status: Skipped,
        },
        stdout: None,
        stderr: None,
        fs: Filesystem {
            context: [],
        },
    },
)
Testing trycmd/hello.trycmd:4 ... ignored
test trycmd_tests ... ok

It seems to me that "file not found" should probably be a test failure (by default?) not ignored?

sourcefrog avatar Jun 26 '22 19:06 sourcefrog

The idea was to gracefully allow mixing untestable examples with testable examples.

We do have the ignore tag and it is unlikely people will have testable and untestable examples within the same code block, so we could probably change this.

epage avatar Jul 20 '22 14:07 epage

Yep, having an option to ignore seems fine, but maybe it should be the wrong default....

Martin

On Wed, Jul 20, 2022 at 7:58 AM Ed Page @.***> wrote:

The idea was to gracefully allow mixing untestable examples with testable examples.

We do have the ignore tag and it is unlikely people will have testable and untestable examples within the same code block, so we could probably change this.

— Reply to this email directly, view it on GitHub https://github.com/assert-rs/trycmd/issues/105#issuecomment-1190394485, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACUR43O2DSIUXTPBVFN2ALVVAHZPANCNFSM5Z4NPIBQ . You are receiving this because you authored the thread.Message ID: @.***>

sourcefrog avatar Jul 20 '22 15:07 sourcefrog

It seems like I had the exact error, just that I couldn't even access detailed error information via --nocapture. This is definitely confusing as I first believed it to be a platform-specific error.

kleinesfilmroellchen avatar Oct 03 '22 20:10 kleinesfilmroellchen

0.14.0 is released with this changed.

epage avatar Oct 06 '22 19:10 epage

I had forgotten: this is important for when examples are conditionally present: https://github.com/clap-rs/clap/pull/4439

epage avatar Nov 03 '22 04:11 epage

Interesting; is there a better solution that covers both use cases?

kleinesfilmroellchen avatar Nov 09 '22 09:11 kleinesfilmroellchen

Hi! I'm a bit new to the project. What do you thing about returning an error if a binary is either skipped or doesn't have a name? The ignored keyword tells my common sense that I wrote a #[skip] on purpose or I forgot to include in a glob path like tests/**/*.toml. Having a console output "test is ignored" but not telling me why was a hard thing to debug in my case

AucaCoyan avatar Feb 20 '24 19:02 AucaCoyan

I'd recommend reviewing the thread for what has been previously considered.

epage avatar Feb 20 '24 19:02 epage