bpo-35617: Fix for unittest discover not working with implicit namespace packages by simonfagerholm · Pull Request #11364 · python/cpython

If the startdir is considered a path, then the discover function does not look for implicit namespace packages. I fixed this.
Now if the startdir is not the topdir its checked for importability (if they are the same, then it should always be importable).
If the startdir does not contain a init.py file, then its considered a implicit namespace package.
To make sure that the directories are importable I changed the code so that ImportError is raised directly when problem is discovered instead of waiting.

The PR seems to fix the problem with this, but might affect other parts that I'm not aware of.

https://bugs.python.org/issue35617