Fixes test environment detection.
Merge pull request #914 from jails/bug/test-environment-detection

Fixes test environment detection.