support for the inverse of testonly |
|||
Issue descriptionThere are cases where library authors don't want users depending on the production versions of code in tests, e.g. because they do expensive operations or depend on the environment. It would be nice to have something like "testonly" but doing the opposite - preventing the target from being included in tests. See background here: https://groups.google.com/a/chromium.org/d/topic/chromium-dev/IuR-pzrQso0/discussion
,
Jun 30 2016
I also fail to see how preventing a target from being included in test could still allow that target's code being tested. And I don't think there should be any untested code.
,
Jun 30 2016
I understand why we don't want to declare a piece of code forever untestable. At the very least, it should be included in system tests. However, there are pieces of code that clearly shouldn't be used in unit tests. When using external services, there always a layer of code that cannot be part of a unit test, because it would actually contact that service. I recently discovered tests that did not realize they were reaching real backends and sharing side effects between runs. Perhaps it is possible to adjust the question: Is there a way to prevent someone from reaching that innermost layer of code, unless they explicitly say it's what they want?
,
Jul 1 2016
So actually the assert_no_deps (described in [1]) suggested by dpranke@ might be the right tool here. It would allow you to forbid depending on the real backend in the unit_tests target. The tricky part would be placing the tests which actually need to depend on this target. It would likely need to be a special test target and the bots would need to know to run it. [1] https://chromium.googlesource.com/chromium/src/+/master/tools/gn/docs/reference.md
,
Nov 10 2017
,
Nov 29
vabr going hobby only -> reducing involvement. Please contact me directly in urgent matters. |
|||
►
Sign in to add a comment |
|||
Comment 1 by dpranke@chromium.org
, Jun 30 2016