This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Andrei Fokau
Recipients Andrei Fokau, barry
Date 2017-02-24.20:16:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1487967420.04.0.20803739138.issue29642@psf.upfronthosting.co.za>
In-reply-to
Content
Ok, it's actually not so hard to work around (for Python 3.6, at least):


import os
from unittest import TestLoader

class CustomTestLoader(TestLoader):
    def _find_test_path(self, full_path, pattern, namespace=False):
        original_isfile = os.path.isfile

        def patched_isfile(path):
            return str(path).endswith('__init__.py') or original_isfile(path)

        os.path.isfile = patched_isfile
        result = super()._find_test_path(full_path=full_path, pattern=pattern,
                                         namespace=namespace)
        os.path.isfile = original_isfile
        return result


I'll try to submit a pull request if it can be resolved properly.
History
Date User Action Args
2017-02-24 20:17:00Andrei Fokausetrecipients: + Andrei Fokau, barry
2017-02-24 20:17:00Andrei Fokausetmessageid: <1487967420.04.0.20803739138.issue29642@psf.upfronthosting.co.za>
2017-02-24 20:17:00Andrei Fokaulinkissue29642 messages
2017-02-24 20:16:59Andrei Fokaucreate