-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
cfg(test) is not set during integration tests #84629
Comments
I believe |
That's a great idea, than you can do |
Although a significant downside is that it adds another variant of the crate that you have to compile, which uses more disk space & time and makes things more complicated for IDEs. |
That downside is not specific to
|
Good point. Perhaps the standard |
#[cfg(test)]
is not set when running integration tests. That page says:But that sounds to me more like it's talking about
pub
,pub(crate)
and so on.There's an unsatisfying workaround but it would be a lot simpler if
#[cfg(test)]
was simply enabled for integration tests. (Here's another person tripping up on this.)The only reason not to do that seems to be a philosophical objection to using hidden APIs in integration tests. I don't agree with that. I'm sure others don't. But even if you subscribe to that philosophy you can simply not use the
#[cfg(test)]
functions in your integration tests (or don't export them). The situation for people who don't subscribe to that philosophy is much more awkward.Changing this behaviour would also fix #45599.
The text was updated successfully, but these errors were encountered: