It seems like this function could just be:
```
static bool InTest(bool flag) {
  static bool in_test = flag;
  return in_test;
}
```

Since we only ever set the local static variable once and we won't ever modify it.

@cmaloney Can you confirm?