These asserts break the directory structure.

I think if you change it to be something like....

if returncode != 0:
    os.chdir(world.basedir)
    assert ....

Then it should work fine. I'll mark the other asserts, but I won't comment like this on the other ones.