Ticket #4086: twisted4086.2.patch
| File twisted4086.2.patch, 2.8 KB (added by necaris, 14 months ago) |
|---|
-
twisted/topfiles/4086.removal
1 The 'unsigned' flag to twisted.scripts.tap2rpm.MyOptions is now deprecated. -
twisted/scripts/test/test_tap2rpm.py
5 5 Tests for L{twisted.scripts.tap2rpm}. 6 6 """ 7 7 import os 8 8 9 from twisted.trial.unittest import TestCase, SkipTest 9 10 from twisted.python import procutils 11 from twisted.python import versions 12 from twisted.python import deprecate 10 13 from twisted.python.failure import Failure 11 14 from twisted.internet import utils 12 15 from twisted.scripts import tap2rpm … … 378 381 379 382 # Try and make an RPM from that tapfile. 380 383 _makeRPMs(tapfile=tapfile) 384 385 386 def test_unsignedFlagDeprecationWarning(self): 387 """ 388 The 'unsigned' flag in tap2rpm should be deprecated, and its use 389 should raise a warning as such. 390 """ 391 config = tap2rpm.MyOptions() 392 config.parseOptions(['--unsigned']) 393 warnings = self.flushWarnings() 394 self.assertEqual(DeprecationWarning, warnings[0]['category']) 395 self.assertEqual( 396 deprecate.getDeprecationWarningString( 397 config.opt_unsigned, versions.Version("Twisted", 12, 2, 0)), 398 warnings[0]['message']) 399 self.assertEqual(1, len(warnings)) -
twisted/scripts/tap2rpm.py
7 7 import tempfile 8 8 import tarfile 9 9 from StringIO import StringIO 10 import warnings 10 11 11 from twisted.python import usage, log 12 from twisted.python import usage, log, versions, deprecate 12 13 13 14 14 15 ################################# … … 138 139 139 140 ############################### 140 141 class MyOptions(usage.Options): 141 optFlags = [[ "unsigned", "u"], ['quiet', 'q']]142 optFlags = [['quiet', 'q']] 142 143 optParameters = [ 143 144 ["tapfile", "t", "twistd.tap"], 144 145 ["maintainer", "m", "tap2rpm"], … … 176 177 self['twistd_option'] = type_dict[self['type']] 177 178 self['release-name'] = '%s-%s' % (self['rpmfile'], self['set-version']) 178 179 180 def opt_unsigned(self): 181 """ 182 Handle the 'unsigned' command-line flag, which is now deprecated in 183 any case. 184 """ 185 msg = deprecate.getDeprecationWarningString( 186 self.opt_unsigned, versions.Version("Twisted", 12, 2, 0)) 187 warnings.warn(msg, category=DeprecationWarning, stacklevel=2) 179 188 180 189 181 190 type_dict = {
