npHardProblem
Ars Tribunus Militum
If you are calling window.location I'm guessing you want to test in a browser as opposed to V8 or some other non-browser JS environment. In that case, I suggest you check out http://phantomjs.org/, it's a headless Webkit implementation. If you are truly paranoid run it in a VirtualBox VM or something, but you should be fine without that. I dunno how you hook into it from Python but I suspect it would not be that hard to figure out (in Ruby-land you would probably want Poltergeist).