def possible_test_module_names(module): module_name = module_path_to_name(module.subpath) for name in ["test_%s", "%s_test", "%sTest", "tests_%s", "%s_tests", "%sTests"]: yield (name % module_name) + ".py" for name in ["test%s", "Test%s", "%sTest", "tests%s", "Tests%s", "%sTests"]: yield (name % module_name.capitalize()) + ".py"
def path2modname(path, default=""): """Take a path to a pythoscope module and return a module name in dot-style notation. Return default if path doesn't point to a pythoscope module. """ match = re.search(r'.*pythoscope%s(.*)$' % re.escape(os.path.sep), path) if match: return module_path_to_name(match.group(1), newsep=".") else: return default
def module_path_to_test_path(module): """Convert a module locator to a proper test filename. """ return "test_%s.py" % module_path_to_name(module)
def _get_locator(self): return module_path_to_name(self.subpath, newsep=".")