importlib.abc.FileLoader.load_module()/get_filename() and
importlib.machinery.ExtensionFileLoader.load_module() have their
single argument be optional as the loader's constructor has all the
ncessary information.
This allows for the deprecation of
imp.load_source()/load_compile()/load_package().
Not that I haven't tested it to make sure it works, just that it
can run against an empty source file.
Initial patch by Popa.Claudiu.
Here we also add a test (which uses mock, which is why I didn't
check it in on 3.2).
This patch changes a few of the scripts to have __name__=='__main__'
clauses so that they are importable without running. Also fixes the
syntax errors revealed by the tests.
When people find bugs in scripts such as reindent.py, msgfmt.py or
pygettext.py, we have to try to reproduce the bug manually, apply a fix
and test manually again. The alternative is to only read the code and
trust that it works. This test file is a way to stop that
unsatisfactory state of things and write proper unit tests instead.