'The templates and System for Twisted includes adding deprecations.'

@doNotFailOnNetworkError
def test_buildWithDeprecated(self):

    stdout = BytesIO()
    self.patch(sys, 'stdout', stdout)
    projectName = 'Foobar'
    packageName = 'quux'
    projectURL = 'scheme:project'
    sourceURL = 'scheme:source'
    docstring = 'text    in    docstring'
    privateDocstring = 'should    also    appear    in    output'
    inputPath = FilePath(self.mktemp()).child(packageName)
    inputPath.makedirs()
    inputPath.child('__init__.py').setContent(u"from    twisted.python.deprecate    import    deprecated\nfrom    incremental    import    Version\n@deprecated(Version('Twisted',    15,    0,    0),    'Baz')\ndef    foo():\n                '{}'\nfrom    twisted.python    import    deprecate\nimport    incremental\n@deprecate.deprecated(incremental.Version('Twisted',    16,    0,    0))\ndef    _bar():\n                '{}'\n@deprecated(Version('Twisted',    14,    2,    3),    replacement='stuff')\nclass    Baz(object):\n                pass".format(docstring, privateDocstring).encode('utf-8'))
    outputPath = FilePath(self.mktemp())
    builder = APIBuilder()
    builder.build(projectName, projectURL, sourceURL, inputPath, outputPath)
    quuxPath = outputPath.child('quux.html')
    self.assertTrue(quuxPath.exists(), ('Package    documentation    file    %r    did    not    exist.' % (quuxPath.path,)))
    self.assertIn(docstring, quuxPath.getContent(), 'Docstring    not    in    package    documentation    file.')
    self.assertIn('foo    was    deprecated    in    Twisted    15.0.0;    please    use    Baz    instead.', quuxPath.getContent())
    self.assertIn('_bar    was    deprecated    in    Twisted    16.0.0.', quuxPath.getContent())
    self.assertIn(privateDocstring, quuxPath.getContent())
    self.assertTrue(quuxPath.sibling('quux.foo.html').exists())
    self.assertIn('foo    was    deprecated    in    Twisted    15.0.0;    please    use    Baz    instead.', quuxPath.sibling('quux.foo.html').getContent())
    self.assertIn('Baz    was    deprecated    in    Twisted    14.2.3;    please    use    stuff    instead.', quuxPath.sibling('quux.Baz.html').getContent())
    self.assertEqual(stdout.getvalue(), '')
