title: How to run test on the source tree in bazel?
body: <p>I am migrating a project from cmake to bazel. I have a folder contains some python code and some <code>genrules</code>.
  I had a test script run all the python tests in this folder recursively.
  So basically I need all py files under this folder as <code>data</code> for the test script. But given there are some genrule I need to run, there are some BUILD files, so that <code>glob(["**/*.py"])</code> can't get through.</p>
  
  <p>For example, we have a folder <code>python</code> contains following files.</p>
  
  <ul>
  <li><p><code>python/BUILD</code></p></li>
  <li><p><code>python/test_a.py</code></p></li>
  <li><p><code>python/folder_a/BUILD</code> this one has genrule in it.</p></li>
  <li><p><code>python/folder_a/folder_b/BUILD</code> this one has genrule as well.</p></li>
  <li><p><code>python/folder_a/folder_b/folder_c/test_b.py</code></p></li>
  </ul>
  
  <p>I want to run the test script under <code>python/</code>, it will run all the <code>test_*.py</code> recursively. Now we want to wrap it as a <code>sh_test</code> in bazel. So we need to specify all the <code>test_*.py</code> in the <code>data</code> field. But there is no easy way to do that since <code>glob()</code> can't get through <code>python/folder_a/BUILD</code> and <code>python/folder_a/folder_b/BUILD</code>.</p>
  
  <p>It will be quite convenience if I can run this script in the source tree. But it seems that bazel didn't provide this. Adding <code>local = 1</code> in <code>sh_test</code> only make the runfiles tree writable.</p>
  
  <p>I know it is not a good way to use bazel to test, but sometimes it is too much work for migrating everything at the same time.</p>