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

Toy project fails to build with features = ["testing"] in 0.8.0 #4307

Open
andybalaam opened this issue Nov 21, 2024 · 2 comments
Open

Toy project fails to build with features = ["testing"] in 0.8.0 #4307

andybalaam opened this issue Nov 21, 2024 · 2 comments

Comments

@andybalaam
Copy link
Member

I am writing a library (matrix-sdk-redis) that depends on matrix-rust-sdk and uses some of its testing facilities, specifically the cryptostore_integration_tests macro. Using this macro is critical for me to be able to check whether my crypto store implementation works.

I upgraded the project to matrix-sdk version 0.8.0 today and I get a compile error when I try to compile the tests. Here is a minimal example:

$ cat Cargo.toml 
[package]
name = "tmp"
version = "0.1.0"
edition = "2021"

[dependencies]
matrix-sdk = "0.8.0"

[dev-dependencies]
matrix-sdk = { version = "0.8.0", features = ["testing"]}
$ cat src/main.rs 
fn main() {
    println!("Hello, world!");
}
$ cargo test
   Compiling matrix-sdk-crypto v0.8.0
error[E0432]: unresolved import `matrix_sdk_test::ruma_response_from_json`
    --> /home/andy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/matrix-sdk-crypto-0.8.0/src/identities/manager.rs:1219:9
     |
1219 |     use matrix_sdk_test::ruma_response_from_json;
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ruma_response_from_json` in the root

error[E0432]: unresolved import `matrix_sdk_test::ruma_response_from_json`
    --> /home/andy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/matrix-sdk-crypto-0.8.0/src/identities/user.rs:1195:9
     |
1195 |     use matrix_sdk_test::ruma_response_from_json;
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ruma_response_from_json` in the root

For more information about this error, try `rustc --explain E0432`.
error: could not compile `matrix-sdk-crypto` (lib) due to 2 previous errors

I've tried to figure out what's wrong and I can't see why it compiles fine in my checkout of matrix-rust-sdk but not when I depend on it as a library. Any help appreciated!

@poljar
Copy link
Contributor

poljar commented Nov 21, 2024

I haven't checked, but probably because we didn't do a release of the matrix-sdk-test crate: https://crates.io/crates/matrix-sdk-test.

I'm not sure we should do so, nor am I sure that the testing feature should exist.

@andybalaam
Copy link
Member Author

Yeah, understood, but I would really like some way of running cryptostore_integration_tests in my crate, and at the moment I think that needs the testing feature.

@poljar poljar mentioned this issue Nov 25, 2024
3 tasks
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