Skip to content

Integration tests can't find crate #1321

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

Closed
OrangeTux opened this issue Dec 16, 2020 · 2 comments · Fixed by #1356
Closed

Integration tests can't find crate #1321

OrangeTux opened this issue Dec 16, 2020 · 2 comments · Fixed by #1356

Comments

@OrangeTux
Copy link
Contributor

OrangeTux commented Dec 16, 2020

This is not a bug in PyO3, but it can hit Pyo3 users nonetheless.

I'm using PyO3 for a project and wrote some integration tests. I put those tests inside a tests/ directory at the crate root. However my tests fail to compile because my crate couldn't be found:

 error[E0463]: can't find crate for `yolo`
   --> tests/tests.rs:4:1
    |
  4 | use yolo;
    | ^^^^^^^^^ can't find crate

It turns out that cdylib crate types can't use tests inside a tests/ directory. See rust-lang/cargo#6659

I think this should be documented, as this is not very obvious. What would be the best place to do that? Inside the FAQ?

@kngwyu
Copy link
Member

kngwyu commented Dec 22, 2020

Thanks.

Inside the FAQ?

Yeah, I think FAQ & Troubleshooting is good and am really appriciate your PR.

OrangeTux pushed a commit to OrangeTux/pyo3 that referenced this issue Dec 22, 2020
Integration tests of a PyO3 project can't be put inside a `tests/`
directory. Due to a known problem Cargo fails to import the crate.

Fixes: PyO3#1321
@OrangeTux
Copy link
Contributor Author

Sure. I just created a PR.

Happy holidays!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants