This would fail on some OSes, probably safer to just forcibly set it to something for the test and then revert back. If you wanted to be extra sexy you could also mock os.environ for this test.