Disable MBT tests if the "mocks" feature is not enabled #643
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.
Closes: #642
Description
Before, running
cargo test
in the root folder would run the MBT tests successfully. However, runningcargo test
inside themodules/
folder doesn't work because the"mocks"
is missing. This hints that runningcargo test
in the root folder is equivalent to runningcargo test --all-features
, but I couldn't find the corresponding documentation.Ideally we would like to always enable the
"mocks"
feature when running tests, independently from where, but unfortunately this seems to not be supported: rust-lang/cargo#2911This PR disables the MBT tests if the "mocks" feature is not enabled, which seemed to be the best workaround suggested in the previous issue: rust-lang/cargo#2911 (comment)
Now, running
cargo test
in the root folder still runs the MBT tests successfully, while runningcargo test
inside themodules/
folder simply ignores them. To also run the MBT tests inside themodules/
folder one has to:cargo test --features mocks
This PR also adds more structure to the MBT tests, as suggested by @adizere in #601 (comment). This is a good suggestion since each file in the
tests/
folder is compiled as it own crate. As a result,step.rs
,modelator.rs
andmodel_based.rs
were all compiled individually, even though only the latter had a test in it.model_based.rs
was renamed tombt.rs
just to minimize the diff in this PR.For contributor use:
docs/
) and code comments.Files changed
in the Github PR explorer.