set debug by test_environment option. Fix #504
remove print
smarter debug setting
Merge pull request #524 from squirrelo/issue-504

Set debug by test_environment option. Fix #504