Comments (6)
Wired!!!!
On my side it works like a charm in all cases
damico@miklap:~/dev_random/rstest_226$ cargo test && cat src/main.rs && cargo clippy && rustup show | tail
Finished test [unoptimized + debuginfo] target(s) in 0.01s
Running unittests src/main.rs (target/debug/deps/rstest_226-a0447c32f017b59d)
running 1 test
test tests::test_fn::case_1 ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
fn main() {
println!("Hello, world!");
}
mod tests {
use rstest::rstest;
#[allow(clippy::too_many_arguments)] // this does not work
#[rstest]
#[allow(clippy::too_many_arguments)] // this does not work
#[case(1, 2, 3, 4, 5, 6, 7, 8)]
#[allow(clippy::too_many_arguments)] // this does not work
fn test_fn(
#[case] _a: u8,
#[case] _b: u8,
#[case] _c: u8,
#[case] _d: u8,
#[case] _e: u8,
#[case] _f: u8,
#[case] _g: u8,
#[case] _h: u8,
) {
}
}
Checking rstest_226 v0.1.0 (/home/mdamico/dev_random/rstest_226)
Finished dev [unoptimized + debuginfo] target(s) in 0.05s
active toolchain
----------------
stable-x86_64-unknown-linux-gnu (default)
rustc 1.74.1 (a28077b28 2023-12-04)
from rstest.
from rstest.
Put it at module level solved the issue. By the way I provide you the example:
#[allow(clippy::too_many_arguments)] // this works
mod tests {
use rstest::rstest;
#[allow(clippy::too_many_arguments)] // this does not work
#[rstest]
#[case(1, 2, 3, 4, 5, 6, 7, 8)]
fn test_fn(
#[case] _a: u8,
#[case] _b: u8,
#[case] _c: u8,
#[case] _d: u8,
#[case] _e: u8,
#[case] _f: u8,
#[case] _g: u8,
#[case] _h: u8,
) {
}
}
from rstest.
Ok... According to https://docs.rs/rstest/latest/rstest/attr.rstest.html#use-specific-case-attributes you should move the annotation before the function instead of put it before #[rstest]
.
from rstest.
Sorry, I should have mentioned before that I tried it already. As you can check:
//#[allow(clippy::too_many_arguments)] // this works
mod tests {
use rstest::rstest;
#[allow(clippy::too_many_arguments)] // this does not work
#[rstest]
#[allow(clippy::too_many_arguments)] // this does not work
#[case(1, 2, 3, 4, 5, 6, 7, 8)]
#[allow(clippy::too_many_arguments)] // this does not work
fn test_fn(
#[case] _a: u8,
#[case] _b: u8,
#[case] _c: u8,
#[case] _d: u8,
#[case] _e: u8,
#[case] _f: u8,
#[case] _g: u8,
#[case] _h: u8,
) {
}
}
from rstest.
Then I guess it's a rust-analyzer
bug
Moreover, If i run cargo clippy -- --deny warnings
, everything works fine
from rstest.
Related Issues (20)
- Misleading error messaging when defining a test that includes a lifetime argument HOT 1
- Support argument destructuring for `#[values(...)]` HOT 1
- Injecting static types HOT 5
- Create a fixture from `files` attribute HOT 3
- skip cases based on feature flag? HOT 5
- `#[once]` fixtures are unsound for types that are not `Sync` HOT 4
- clippy::duplicated_attributes warning with rust 1.79.0-nightly HOT 3
- By-reference fixtures HOT 12
- Update `rstest_reuse` docs and release new version
- `#[from(source)]` should accept path also and not just idents
- rstest_reuse: "the `async` keyword is missing from the function declaration" HOT 1
- replace return <expr>; with <expr> [needless_return] HOT 3
- Support dynamic `#[values]` HOT 1
- Feature: Optional label in the `#[case...]` HOT 1
- Dynamically set #[values(..)] HOT 1
- New test files are only recognized after `cargo clean` HOT 4
- feat: provide a cargo feature to disable the proc macro inference in #221 HOT 2
- consider adding a `wasm-bindgen` feature HOT 1
- Recommendation on choosing between different sets of `#[values(...)]`?
- Mixing `#[rstest]` and `#[serial]` breaks VS Code's IntelliSense with rust-analyzer HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rstest.