Stub atexit.register in tests

See [1] for an example of problems using the real atexit can cause.

[1] https://bitbucket.org/ned/coveragepy/issue/273/assert-self_collectors-when-trying-to