Make tests independent of environment
(cherry picked from commit 473b5d792fababed344667e25ef1fab6d3a9f360)