Ticket #4086: twisted4086.patch
| File twisted4086.patch, 2.2 KB (added by necaris, 15 months ago) |
|---|
-
twisted/scripts/test/test_tap2rpm.py
5 5 Tests for L{twisted.scripts.tap2rpm}. 6 6 """ 7 7 import os 8 import warnings 9 8 10 from twisted.trial.unittest import TestCase, SkipTest 9 11 from twisted.python import procutils 12 from twisted.python import versions 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 "The 'unsigned' flag is deprecated, as it's not currently used.", 397 warnings[0]['message']) 398 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 12 from twisted.python import usage, log 12 13 … … 138 139 139 140 ############################### 140 141 class MyOptions(usage.Options): 141 optFlags = [[ "unsigned", "u"], ['quiet', 'q']]142 optFlags = [['unsigned', 'u'], ['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 # Deprecated 'unsigned' flag 181 msg = "The 'unsigned' flag is deprecated, as it's not currently used." 182 warnings.warn(msg, category=DeprecationWarning, stacklevel=2) 179 183 180 184 181 185 type_dict = {
