in testslide/cli.py [0:0]
def _filename_to_module_name(name: str) -> str:
if not (
os.path.isfile(name)
and (name.lower().endswith(".py") or name.lower().endswith(".pyc"))
):
raise ValueError("Expected a .py file, got {}".format(name))
if os.path.isabs(name):
name = os.path.relpath(name, os.getcwd())
if name.lower().endswith(".pyc"):
end = -4
else:
end = -3
return name[:end].replace(os.path.sep, ".")