This is related to Can #[cfg(test)] load parent module twice with different configs? - #2 by jonh
My question is:
- I have a crate_foo
- I have a crate_bar
- crate_foo does NOT depend on crate_bar
Question: is a unit test of crate_foo allowed to depend on crate_bar ?
Intuition suggests no, but I want to double check.
I think dev-dependencies are loaded for tests, but if not you can use a feature that is only enabled in tests. Try adding it to dev-dependencies first.
Your suggestion is perfectly valid.
I abstracted too much of the original XY problem. The situation is:
crate num_base
crate num_base_cpu = num_base w/ feature cpu
crate num_base_gpu = num_base w/ feature gpu
this would be a Circular dependency to have the unit testing of num_base depend on num_base_cpu and num_base_gpu