def run_trial():
    from twisted.python import modules

    # We monkey patch PythonModule in order to avoid tests inside namespace packages
    # being run multiple times (see http://twistedmatrix.com/trac/ticket/5030)
    
    PythonModule = modules.PythonModule

    class PatchedPythonModule(PythonModule):
        def walkModules(self, *a, **kw):
            yielded = set()
            # calling super on PythonModule instead of PatchedPythonModule, since we're monkey patching PythonModule
            for module in super(PythonModule, self).walkModules(*a, **kw):
                if module.name in yielded:
                    continue
                yielded.add(module.name)
                yield module

    modules.PythonModule = PatchedPythonModule

    from twisted.scripts.trial import run
    run()
dataset/ETHPy150Open foundit/Piped/piped/scripts.py/run_trial/original