Test suites with complicated configuration logic may wish to split this logic up over multiple packages / modules. This is currently tricky because in order to do import x from the same directory, the directory has to be in sys.path. What I'd really like is to find a way to make the test suite an actual package. It seems that due to the way we compile / exec it, it's still part of the lit.llvm package. (For example, the value of __package__ from within one of these files is 'lit.llvm'. It would be nice if we could detach it from the top-level lit package and make it be its own package. This way from . import foo would "just work".
Anyway, that's for another day, for now this at least allows it to work.
Won't this always reset the path back to the original path since the finally block always executes?