fix building crates standalone#34
Open
obbardc wants to merge 2 commits into
Open
Conversation
The test suite calls Response::json() in several modules which reqwest
gates behind its `json` feature. The dev-dependency on reqwest did not
enable it.
This compiled only by accident: the tests depend on the workspace
`lava-api` crate which enables reqwest/json.
When built standalone (e.g. from the published crate on crates.io) that
sibling is absent; the "json" feature is not enabled, thus the tests
fail to compile with:
error[E0599]: no method named `json` found for struct `Response`
Declare the json feature explicitly in lava-api-mock's dev-dependency
so the tests build regardless of workspace context.
This can be reproduced with:
cargo package -p lava-api-mock --allow-dirty
cd target/package/lava-api-mock-0.2.1
cargo test
Signed-off-by: Christopher Obbard <obbardc@gmail.com>
The crate example uses the lava-api client to read data back from the mock LAVA server. Since lava-api dev-depends on lava-api-mock, compiling this as a doctest introduces a dependency cycle: cargo package strips the path-only lava-api dev-dependency, so a standalone build of lava-api-mock fails to compile the doctest. Mark the example as ignore so it is still rendered in the docs but not compiled, allowing the crate to build standalone. Signed-off-by: Christopher Obbard <obbardc@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The test suite calls Response::json() in several modules which reqwest gates behind its
jsonfeature. The dev-dependency on reqwest did not enable it.This compiled only by accident: the tests depend on the workspace
lava-apicrate which enables reqwest/json.When built standalone (e.g. from the published crate on crates.io) that sibling is absent; the "json" feature is not enabled, thus the tests fail to compile with:
Declare the json feature explicitly in lava-api-mock's dev-dependency so the tests build regardless of workspace context.
This can be reproduced with: