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

Test get ignored when running in vs code in combination with [ignore] macro #93

Closed
jb-alvarado opened this issue Feb 9, 2023 · 8 comments

Comments

@jb-alvarado
Copy link

Hello,

I would like to use a test like:

#[test]
#[serial]
#[ignore]
fn my_special_test() {...}

When I run command line:

cargo test -- --ignored

everything works like suspected. But when I try to run a single test in vs code with:
run_rest
clicking Run Test, this test get ignored.

Without #[serial] macro the test run through.

Do you have any idea, how to fix this?

@palfrey
Copy link
Owner

palfrey commented Feb 12, 2023

Not sure. I've been poking at this a bit, and trying to figure out what the actual invocation VS Code is using i.e. what Rust command line it's running. We ignore the ignore attributes when doing some of the processing as they get dealt with by the stock test runner, but I'm guessing VS Code does some other magic and I'm not sure what that is, which will be the key to figuring this out.

@jb-alvarado
Copy link
Author

Yes I have seen now that it looks like, it is an issue with vs code. Because when no #[serial] marco is set, it runs the command:

cargo test --package tests --test test_file --all-features -- test_function --exact --nocapture --ignored

But when is set, vs code runs:

cargo test --package tests --test test_file --all-features -- test_function --exact --nocapture

@palfrey
Copy link
Owner

palfrey commented Feb 13, 2023

This might be due to some stuff serial_test does. Can you test out your case with the code from #94 and see if it fixes things?

@jb-alvarado jb-alvarado reopened this Feb 13, 2023
@jb-alvarado
Copy link
Author

I have test now #94 and it seems that it works.

@palfrey
Copy link
Owner

palfrey commented Feb 13, 2023

I have test now #94 and it seems that it works.

Hmm. Interesting. So, I know kinda why that code was there to begin with, but I can't reproduce the problem anymore. Let me prod the original reporters...

@palfrey
Copy link
Owner

palfrey commented Feb 24, 2023

I've merged #94 which fixed this, so closing.

@palfrey palfrey closed this as completed Feb 24, 2023
@jb-alvarado
Copy link
Author

Thank you!

@palfrey
Copy link
Owner

palfrey commented Mar 30, 2023

Released as 2.0.0

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

No branches or pull requests

2 participants