You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a burn-tensor crate that defines tensor operations and traits, and I have separate backend crates (burn-ndarray and burn-tch) that implement these traits for specific tensor backends.
How can I use rstest to write tests for the tensor operations in the burn-tensor crate and inject static backend types into the tests?
A couple of constraints that I wish to keep: 1) I do not want to define macro in burn-tensor crate that will be re-imported into the backend crates (this is how it's currently done 2) I do not want burn-tensor to depend on the backend crates.
The text was updated successfully, but these errors were encountered:
@a10736, thank you so much for you suggestion and great examples. rstest_reuse is a great pointer. I didn't know about it.
Continuing with your example, let me clarify.
Basically, I need to have MyTrait and the unit tests defined in crate "MyTraitAndTests". And the trait implementations in "ImplA" and "ImplB" crates, which will consume the unit tests defined in "MyTraitAndTests". It would very convenient when I import the unit tests, I can pass type A (that implements MyTrait) to a whole suit without referencing individual methods. It seems rstest_reuse supports such use case, correct?
I have a burn-tensor crate that defines tensor operations and traits, and I have separate backend crates (burn-ndarray and burn-tch) that implement these traits for specific tensor backends.
How can I use rstest to write tests for the tensor operations in the burn-tensor crate and inject static backend types into the tests?
A couple of constraints that I wish to keep: 1) I do not want to define macro in burn-tensor crate that will be re-imported into the backend crates (this is how it's currently done 2) I do not want burn-tensor to depend on the backend crates.
The text was updated successfully, but these errors were encountered: