Tests: avoid leaking into global scope

This means that this will pass without error:

http://127.0.0.1:8000/test/test.html?noglobals=true
Merge pull request #148 from acdha/test-globals-cleanup

Tests: avoid leaking into global scope