def test_get_module_name_path4(): def yay(): pass yay.__module__ = "__main__" sys.modules["__main__"].__file__ = "a/b.py" # Calling the function on itself assert utils._get_module_name(yay) == "a.b"
def test_get_module_name_path2(): def yay(): pass yay.__module__ = "__main__" # We're probably doing strange things to the pytest binary # but it's probably harmless del sys.modules["__main__"].__file__ # Calling the function on itself assert utils._get_module_name(yay) == "__main__"
def test_get_module_name_path1(): # Calling the function on itself assert utils._get_module_name(utils._get_module_name) == "procrastinate.utils"