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

doctests fail with default features disabled #80

Closed
jelmer opened this issue Dec 22, 2023 · 5 comments
Closed

doctests fail with default features disabled #80

jelmer opened this issue Dec 22, 2023 · 5 comments

Comments

@jelmer
Copy link
Contributor

jelmer commented Dec 22, 2023

I get 25 failures, most related to docstrings for runtime. Happy to provide a PR, but I'm not sure what the best approach here is.

One option would be to add "#[cfg(feature = "runtime")] {" blocks to each of the docstrings, but that seems a bit repetitive.

@yanganto
Copy link
Owner

yanganto commented Dec 22, 2023

I use examples for tests, and that is exactly what I run for each test

test-with/flake.nix

Lines 33 to 49 in 90ff555

cargo run --no-default-features --features=http --example=http
cargo run --no-default-features --features=icmp --example=icmp
cargo run --no-default-features --example=tcp
cargo run --no-default-features --features=net --example=http
cargo run --no-default-features --features=net --example=icmp
cargo run --no-default-features --features=user --example=user
cargo run --no-default-features --features=resource --example=resource
cargo run --no-default-features --features=executable --example=executable
cargo install cargo-hack
cargo hack test --examples
# runtime ignore example
cd examples/runner
cargo run --example test
cargo run --example mock
cargo run --example mock2
cargo run --example mix

If you use nix shell, you can type feature-test to test all of them. If you do not want to use nix shell, you can open a working branch and use Github CI to test on the working branch.
Or if you can put #[cfg(feature = "runtime")] if that is easier from your end.

If you see something is too verbose, or not DRY, I will also be happy to get a refactor.

:)

@jelmer
Copy link
Contributor Author

jelmer commented Dec 22, 2023

In that case, will it actually run the docstring tests at all?

I'm running "cargo test --no-default-features", which will also run the docstrings.

@yanganto
Copy link
Owner

No, it didn't. Thanks for pointing out this.

One of the dev dependencies is missing, I put it back in #81
Now we can run it with all the features.
cargo test --all-features

@yanganto
Copy link
Owner

yanganto commented Jan 3, 2024

Hi @jelmer,
Happy New Year. Do you work on this? Is there any other issue you run into?

@jelmer
Copy link
Contributor Author

jelmer commented Jan 3, 2024

Hi @yanganto , I'd already patched the Debian package but I'll take another look when I do the next upload. Let's close this issue if you believe it's been fixed - I can always reopen it if it doesn't work for me?

@jelmer jelmer closed this as completed Jan 3, 2024
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