nose-devs/nose — pull request #719 by pib (2013-08-01 03:01:21+00:00)
Title: Fix Importer.importFromPath to be able to import modules whose names start with __init__

When using [pyflymake](/akaihola/flymake-python), flymake creates a temporary file like {current_file}_flymake.py and then runs its various commands on that file rather than the original file.

The problem is, when pyflymake is configured to run nosetests and it runs on __init__.py somewhere, it creates __init___flymake.py, which then proceeds to cause nose to think it can't find the file.

I've provided the very simple fix as well as a regression test.

As far as I can tell, there's no reason to just check for a prefix of "__init__" instead of just checking if the last item in the path is "__init__.py".

An alternative could be to check for a prefix of "__init__.", but I'm not sure what the use case is. Is there a case where a file other than __init__.py is going to somehow be treated as the init module for a package?