'Create a file that will have known line numbers when emitting warnings.'

def setUp(self):

    self.package = FilePath(self.mktemp().encode('utf-8')).child('twisted_private_helper')
    self.package.makedirs()
    self.package.child('__init__.py').setContent('')
    self.package.child('module.py').setContent('\n"A    module    string"\n\nfrom    twisted.python    import    deprecate\n\ndef    testFunction():\n                "A    doc    string"\n                a    =    1    +    2\n                return    a\n\ndef    callTestFunction():\n                b    =    testFunction()\n                if    b    ==    3:\n                                deprecate.warnAboutFunction(testFunction,    "A    Warning    String")\n')
    packagePath = self.package.parent().path.decode('utf-8')
    sys.path.insert(0, packagePath)
    self.addCleanup(sys.path.remove, packagePath)
    modules = sys.modules.copy()
    self.addCleanup((lambda : (sys.modules.clear(), sys.modules.update(modules))))
    if (platform.isWindows() and _PY3):
        self.flushWarnings()
