Merge lp:~vila/bzr/deprecation-warning-preference into lp:bzr

Proposed by Vincent Ladeuil
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~vila/bzr/deprecation-warning-preference
Merge into: lp:bzr
Diff against target: 404 lines (+189/-39)
9 files modified
NEWS (+9/-0)
bzrlib/branch.py (+2/-0)
bzrlib/config.py (+26/-1)
bzrlib/help_topics/en/configuration.txt (+12/-0)
bzrlib/remote.py (+5/-0)
bzrlib/repofmt/pack_repo.py (+2/-8)
bzrlib/repository.py (+16/-9)
bzrlib/tests/blackbox/test_exceptions.py (+66/-11)
bzrlib/tests/test_config.py (+51/-10)
To merge this branch: bzr merge lp:~vila/bzr/deprecation-warning-preference
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+16233@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) wrote :

This patch supersedes https://code.edge.launchpad.net/~ted/bzr/deprecation-warning-preference/+merge/15455

It's a patch pilot attempt to land a work started by fullermd far too long ago and re-started by ted more recently.

I tried to capture most of the comments by Ian, Martin and John without spending too much time on it (but still...).

This patch adds:
- specifying a suppress_warnings variable in any configuration file,
- explicitly requiring a config variable as a list,
- a suppres_warning() method to config files,
- checks for format_deprecation at lock time on branch objects (which can then provide
  their config to the repo before locking it),
- checks for format_deprecation at lock on repo objects but relying on bazaar.conf only
  in that case.

I may file a bug or three for the remaining points so please comment if you disagree
with some decision made here but mention if you agree with postponing it (good) or you
think it's required to land (bad :).
The idea was to implement something that we could tweak further
but that will not require some upgrade dance in the future (so mainly: keep the same
variable name, don't force setting it in bazaar.conf so the default behaviour for
new branches is still to raise the warning).

These remaining points are:
- the actual implementation use a single global variable for the whole code base,
  forget about being warned for the second repo accessed (or the 20th for bzrlib users),
  that should be implemented as a repo attribute instead,
- working trees can raise format deprecation warnings too, they should use the new
  facility (I don't think we want to proliferate warning variables gratuitously)
- hpss remote repositories doesn't raise the warning locally (AFAICS but feel free
  to prove me wrong),
- no distinction is made between read and write access (I'm not sure I understand
  the need here),
- there is no config file for repositories were such an option can be specified.

My intent here is to provide a base for future work without addressing some existing problems (some of which have been revealed while writing this patch).

I didn't address John idea about filtering by format as I think we plan to
reduce the number of formats and push people to use the default ones.
The rationale is that: 1) you care or you don't care about being warned, 2) you can set
the option in various ways, the finest grain being the branch. I think that's
good enough.

Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vincent Ladeuil wrote:
> Vincent Ladeuil has proposed merging lp:~vila/bzr/deprecation-warning-preference into lp:bzr.
>
> Requested reviews:
> bzr-core (bzr-core)
>
>

...

>
> I didn't address John idea about filtering by format as I think we plan to
> reduce the number of formats and push people to use the default ones.
> The rationale is that: 1) you care or you don't care about being warned, 2) you can set
> the option in various ways, the finest grain being the branch. I think that's
> good enough.
>
>
>

Well, *I* may not care about using --1.9, but I don't want to be using
- --weave anymore. Not to say other people are in that boat.

v- Is the extra 's' for extra suppression ?

+* The ``suppresss_warnings`` configuration option has been introduced and
+ accept the ``format_deprecation`` value to disable the corresponding
+ warning for repositories. It can be set to in either ``bazaar.conf``,
+ ``locations.conf`` or ``branch.conf``.
+ (Ted Gould, Matthew Fuller, Vincent Ladeuil)

You can use

config.LocationConfig(repo.bzrdir.root_transport.base) if you wanted to
support per-repo configuration.

Otherwise:

 review: approve
 merge: approve

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkspC1gACgkQJdeBCYSNAAMPagCgj07xNFxCF94NE0Lv+YtQXagO
+9UAnRLpaeeM3hjUd6OovoZJm2CAcbCF
=Y17e
-----END PGP SIGNATURE-----

review: Approve
Revision history for this message
Martin Pool (mbp) wrote :

Skimmed, looks good, thanks!

--
Martin <http://launchpad.net/~mbp/>

Revision history for this message
Vincent Ladeuil (vila) wrote :

>>>>> "jam" == John A Meinel <email address hidden> writes:

<snip/>

    jam> Well, *I* may not care about using --1.9, but I don't
    jam> want to be using --weave anymore. Not to say other
    jam> people are in that boat.

What I meant (and forgot to add when writing the cover letter) is
that it's highly likely that people are coherent and use the same
format inside project boundaries so giving a path-based control
over the warning should be pretty close in ease of use to a
format-based control.

But the later is harder to implement and likely harder to use
(and my main point was that we don't want people to get involved
into all of your existing formats if we can avoid it :-)

    jam> v- Is the extra 's' for extra suppression ?

Exactly, I think I made that typo at least 50 times so be
grateful that I left only one as I'm grateful you caught it :D

    jam> +* The ``suppresss_warnings`` configuration option has been introduced and
    jam> + accept the ``format_deprecation`` value to disable the corresponding
    jam> + warning for repositories. It can be set to in either ``bazaar.conf``,
    jam> + ``locations.conf`` or ``branch.conf``.
    jam> + (Ted Gould, Matthew Fuller, Vincent Ladeuil)

    jam> You can use

    jam> config.LocationConfig(repo.bzrdir.root_transport.base) if you wanted to
    jam> support per-repo configuration.

I almost implemented it. I almost mentioned it in the cover letter.

But I had a bad feeling about it, it smells like a workaround. I
don't want to create yet another config file but at the same time
I have a feeling that it may address some other needs.

This needs discussion anyway so I didn't feel bad enough to
implement config.LocationConfig(repo.bzrdir.root_transport.base).

    jam> Otherwise:

    jam> review: approve
    jam> merge: approve

Thanks, you didn't comment on the remaining points so I've filed
bug #497694, comments there welcome.

    Vincent

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2009-12-15 19:59:00 +0000
+++ NEWS 2009-12-16 10:09:27 +0000
@@ -95,6 +95,7 @@
95* ``bzr commit`` now has a ``--commit-time`` option.95* ``bzr commit`` now has a ``--commit-time`` option.
96 (Alexander Sack, #459276)96 (Alexander Sack, #459276)
9797
98<<<<<<< TREE
98* ``-Dhpss`` now increases logging done when run on the bzr server,99* ``-Dhpss`` now increases logging done when run on the bzr server,
99 similarly to how it works on the client. (John Arbash Meinel)100 similarly to how it works on the client. (John Arbash Meinel)
100101
@@ -108,6 +109,14 @@
108 lengths. 109 lengths.
109 (Vincent Ladeuil)110 (Vincent Ladeuil)
110111
112=======
113* The ``suppresss_warnings`` configuration option has been introduced and
114 accept the ``format_deprecation`` value to disable the corresponding
115 warning for repositories. It can be set to in either ``bazaar.conf``,
116 ``locations.conf`` or ``branch.conf``.
117 (Ted Gould, Matthew Fuller, Vincent Ladeuil)
118
119>>>>>>> MERGE-SOURCE
111Bug Fixes120Bug Fixes
112*********121*********
113122
114123
=== modified file 'bzrlib/branch.py'
--- bzrlib/branch.py 2009-12-04 22:13:52 +0000
+++ bzrlib/branch.py 2009-12-16 10:09:27 +0000
@@ -2143,6 +2143,7 @@
2143 # All-in-one needs to always unlock/lock.2143 # All-in-one needs to always unlock/lock.
2144 repo_control = getattr(self.repository, 'control_files', None)2144 repo_control = getattr(self.repository, 'control_files', None)
2145 if self.control_files == repo_control or not self.is_locked():2145 if self.control_files == repo_control or not self.is_locked():
2146 self.repository._warn_if_deprecated(self)
2146 self.repository.lock_write()2147 self.repository.lock_write()
2147 took_lock = True2148 took_lock = True
2148 else:2149 else:
@@ -2160,6 +2161,7 @@
2160 # All-in-one needs to always unlock/lock.2161 # All-in-one needs to always unlock/lock.
2161 repo_control = getattr(self.repository, 'control_files', None)2162 repo_control = getattr(self.repository, 'control_files', None)
2162 if self.control_files == repo_control or not self.is_locked():2163 if self.control_files == repo_control or not self.is_locked():
2164 self.repository._warn_if_deprecated(self)
2163 self.repository.lock_read()2165 self.repository.lock_read()
2164 took_lock = True2166 took_lock = True
2165 else:2167 else:
21662168
=== modified file 'bzrlib/config.py'
--- bzrlib/config.py 2009-12-02 22:04:04 +0000
+++ bzrlib/config.py 2009-12-16 10:09:27 +0000
@@ -190,11 +190,23 @@
190 """Get a generic option as a boolean - no special process, no default.190 """Get a generic option as a boolean - no special process, no default.
191191
192 :return None if the option doesn't exist or its value can't be192 :return None if the option doesn't exist or its value can't be
193 interpreted as a boolean. Returns True or False ortherwise.193 interpreted as a boolean. Returns True or False otherwise.
194 """194 """
195 s = self._get_user_option(option_name)195 s = self._get_user_option(option_name)
196 return ui.bool_from_string(s)196 return ui.bool_from_string(s)
197197
198 def get_user_option_as_list(self, option_name):
199 """Get a generic option as a list - no special process, no default.
200
201 :return None if the option doesn't exist. Returns the value as a list
202 otherwise.
203 """
204 l = self._get_user_option(option_name)
205 if isinstance(l, (str, unicode)):
206 # A single value, most probably the user forgot the final ','
207 l = [l]
208 return l
209
198 def gpg_signing_command(self):210 def gpg_signing_command(self):
199 """What program should be used to sign signatures?"""211 """What program should be used to sign signatures?"""
200 result = self._gpg_signing_command()212 result = self._gpg_signing_command()
@@ -313,6 +325,19 @@
313 path = 'bzr'325 path = 'bzr'
314 return path326 return path
315327
328 def suppress_warning(self, warning):
329 """Should the warning be suppressed or emitted.
330
331 :param warning: The name of the warning being tested.
332
333 :returns: True if the warning should be suppressed, False otherwise.
334 """
335 warnings = self.get_user_option_as_list('suppress_warnings')
336 if warnings is None or warning not in warnings:
337 return False
338 else:
339 return True
340
316341
317class IniBasedConfig(Config):342class IniBasedConfig(Config):
318 """A configuration policy that draws from ini files."""343 """A configuration policy that draws from ini files."""
319344
=== modified file 'bzrlib/help_topics/en/configuration.txt'
--- bzrlib/help_topics/en/configuration.txt 2009-10-02 09:11:43 +0000
+++ bzrlib/help_topics/en/configuration.txt 2009-12-16 10:09:27 +0000
@@ -428,6 +428,18 @@
428A publically-accessible version of this branch (implying that this version is428A publically-accessible version of this branch (implying that this version is
429not publically-accessible). Used (and set) by ``bzr send``.429not publically-accessible). Used (and set) by ``bzr send``.
430430
431suppress_warnings
432~~~~~~~~~~~~~~~~~
433
434A list of strings, each string represent a warning that can be emitted by
435bzr. Mentioning a warning in this list tells bzr to not emit it.
436
437Valid values:
438
439* ``format_deprecation``:
440 whether the format deprecation warning is shown on repositories that are
441 using deprecated formats.
442
431443
432Branch type specific options444Branch type specific options
433----------------------------445----------------------------
434446
=== modified file 'bzrlib/remote.py'
--- bzrlib/remote.py 2009-11-11 06:50:40 +0000
+++ bzrlib/remote.py 2009-12-16 10:09:27 +0000
@@ -951,6 +951,11 @@
951 def is_write_locked(self):951 def is_write_locked(self):
952 return self._lock_mode == 'w'952 return self._lock_mode == 'w'
953953
954 def _warn_if_deprecated(self, branch=None):
955 # If we have a real repository, the check will be done there, if we
956 # don't the check will be done remotely.
957 pass
958
954 def lock_read(self):959 def lock_read(self):
955 # wrong eventually - want a local lock cache context960 # wrong eventually - want a local lock cache context
956 if not self._lock_mode:961 if not self._lock_mode:
957962
=== modified file 'bzrlib/repofmt/pack_repo.py'
--- bzrlib/repofmt/pack_repo.py 2009-10-29 05:54:49 +0000
+++ bzrlib/repofmt/pack_repo.py 2009-12-16 10:09:27 +0000
@@ -2234,16 +2234,10 @@
2234 self._reconcile_fixes_text_parents = True2234 self._reconcile_fixes_text_parents = True
2235 self._reconcile_backsup_inventory = False2235 self._reconcile_backsup_inventory = False
22362236
2237 def _warn_if_deprecated(self):2237 def _warn_if_deprecated(self, branch=None):
2238 # This class isn't deprecated, but one sub-format is2238 # This class isn't deprecated, but one sub-format is
2239 if isinstance(self._format, RepositoryFormatKnitPack5RichRootBroken):2239 if isinstance(self._format, RepositoryFormatKnitPack5RichRootBroken):
2240 from bzrlib import repository2240 super(KnitPackRepository, self)._warn_if_deprecated(branch)
2241 if repository._deprecation_warning_done:
2242 return
2243 repository._deprecation_warning_done = True
2244 warning("Format %s for %s is deprecated - please use"
2245 " 'bzr upgrade --1.6.1-rich-root'"
2246 % (self._format, self.bzrdir.transport.base))
22472241
2248 def _abort_write_group(self):2242 def _abort_write_group(self):
2249 self.revisions._index._key_dependencies.clear()2243 self.revisions._index._key_dependencies.clear()
22502244
=== modified file 'bzrlib/repository.py'
--- bzrlib/repository.py 2009-12-03 05:31:03 +0000
+++ bzrlib/repository.py 2009-12-16 10:09:27 +0000
@@ -24,6 +24,7 @@
24 bzrdir,24 bzrdir,
25 check,25 check,
26 chk_map,26 chk_map,
27 config,
27 debug,28 debug,
28 errors,29 errors,
29 fetch as _mod_fetch,30 fetch as _mod_fetch,
@@ -1304,11 +1305,6 @@
1304 self._reconcile_does_inventory_gc = True1305 self._reconcile_does_inventory_gc = True
1305 self._reconcile_fixes_text_parents = False1306 self._reconcile_fixes_text_parents = False
1306 self._reconcile_backsup_inventory = True1307 self._reconcile_backsup_inventory = True
1307 # not right yet - should be more semantically clear ?
1308 #
1309 # TODO: make sure to construct the right store classes, etc, depending
1310 # on whether escaping is required.
1311 self._warn_if_deprecated()
1312 self._write_group = None1308 self._write_group = None
1313 # Additional places to query for data.1309 # Additional places to query for data.
1314 self._fallback_repositories = []1310 self._fallback_repositories = []
@@ -1389,6 +1385,7 @@
1389 locked = self.is_locked()1385 locked = self.is_locked()
1390 result = self.control_files.lock_write(token=token)1386 result = self.control_files.lock_write(token=token)
1391 if not locked:1387 if not locked:
1388 self._warn_if_deprecated()
1392 self._note_lock('w')1389 self._note_lock('w')
1393 for repo in self._fallback_repositories:1390 for repo in self._fallback_repositories:
1394 # Writes don't affect fallback repos1391 # Writes don't affect fallback repos
@@ -1400,6 +1397,7 @@
1400 locked = self.is_locked()1397 locked = self.is_locked()
1401 self.control_files.lock_read()1398 self.control_files.lock_read()
1402 if not locked:1399 if not locked:
1400 self._warn_if_deprecated()
1403 self._note_lock('r')1401 self._note_lock('r')
1404 for repo in self._fallback_repositories:1402 for repo in self._fallback_repositories:
1405 repo.lock_read()1403 repo.lock_read()
@@ -2782,13 +2780,22 @@
2782 result.check(callback_refs)2780 result.check(callback_refs)
2783 return result2781 return result
27842782
2785 def _warn_if_deprecated(self):2783 def _warn_if_deprecated(self, branch=None):
2786 global _deprecation_warning_done2784 global _deprecation_warning_done
2787 if _deprecation_warning_done:2785 if _deprecation_warning_done:
2788 return2786 return
2789 _deprecation_warning_done = True2787 try:
2790 warning("Format %s for %s is deprecated - please use 'bzr upgrade' to get better performance"2788 if branch is None:
2791 % (self._format, self.bzrdir.transport.base))2789 conf = config.GlobalConfig()
2790 else:
2791 conf = branch.get_config()
2792 if conf.suppress_warning('format_deprecation'):
2793 return
2794 warning("Format %s for %s is deprecated -"
2795 " please use 'bzr upgrade' to get better performance"
2796 % (self._format, self.bzrdir.transport.base))
2797 finally:
2798 _deprecation_warning_done = True
27922799
2793 def supports_rich_root(self):2800 def supports_rich_root(self):
2794 return self._format.rich_root_data2801 return self._format.rich_root_data
27952802
=== modified file 'bzrlib/tests/blackbox/test_exceptions.py'
--- bzrlib/tests/blackbox/test_exceptions.py 2009-08-20 06:25:02 +0000
+++ bzrlib/tests/blackbox/test_exceptions.py 2009-12-16 10:09:27 +0000
@@ -22,8 +22,11 @@
2222
23from bzrlib import (23from bzrlib import (
24 bzrdir,24 bzrdir,
25 config,
25 errors,26 errors,
27 osutils,
26 repository,28 repository,
29 tests,
27 trace,30 trace,
28 )31 )
2932
@@ -45,18 +48,70 @@
45 self.assertContainsRe(err, r'Bazaar has encountered an internal error')48 self.assertContainsRe(err, r'Bazaar has encountered an internal error')
4649
4750
48class TestDeprecationWarning(TestCaseInTempDir):51class TestDeprecationWarning(tests.TestCaseWithTransport):
52 """The deprecation warning is controlled via a global variable:
53 repository._deprecation_warning_done. As such, it can be emitted only once
54 during a bzr invocation, no matter how many repositories are involved.
55
56 It would be better if it was a repo attribute instead but that's far more
57 work than I want to do right now -- vila 20091215.
58 """
59
60 def setUp(self):
61 super(TestDeprecationWarning, self).setUp()
62 self.disable_deprecation_warning()
63
64 def enable_deprecation_warning(self, repo=None):
65 """repo is not used yet since _deprecation_warning_done is a global"""
66 repository._deprecation_warning_done = False
67
68 def disable_deprecation_warning(self, repo=None):
69 """repo is not used yet since _deprecation_warning_done is a global"""
70 repository._deprecation_warning_done = True
71
72 def make_obsolete_repo(self, path):
73 # We don't want the deprecation raising during the repo creation
74 tree = self.make_branch_and_tree(path, format=bzrdir.BzrDirFormat5())
75 return tree
76
77 def check_warning(self, present):
78 if present:
79 check = self.assertContainsRe
80 else:
81 check = self.assertNotContainsRe
82 check(self._get_log(keep_log_file=True), 'WARNING.*bzr upgrade')
4983
50 def test_repository_deprecation_warning(self):84 def test_repository_deprecation_warning(self):
51 """Old formats give a warning"""85 """Old formats give a warning"""
52 # the warning's normally off for testing but we reenable it86 self.make_obsolete_repo('foo')
53 repository._deprecation_warning_done = False87 self.enable_deprecation_warning()
54 try:88 out, err = self.run_bzr('status', working_dir='foo')
55 os.mkdir('foo')89 self.check_warning(True)
56 bzrdir.BzrDirFormat5().initialize('foo')90
57 out, err = self.run_bzr("status foo")91 def test_repository_deprecation_warning_suppressed_global(self):
58 self.assertContainsRe(self._get_log(keep_log_file=True),92 """Old formats give a warning"""
59 "bzr upgrade")93 conf = config.GlobalConfig()
60 finally:94 conf.set_user_option('suppress_warnings', 'format_deprecation')
61 repository._deprecation_warning_done = True95 self.make_obsolete_repo('foo')
96 self.enable_deprecation_warning()
97 out, err = self.run_bzr('status', working_dir='foo')
98 self.check_warning(False)
99
100 def test_repository_deprecation_warning_suppressed_locations(self):
101 """Old formats give a warning"""
102 self.make_obsolete_repo('foo')
103 conf = config.LocationConfig(osutils.pathjoin(self.test_dir, 'foo'))
104 conf.set_user_option('suppress_warnings', 'format_deprecation')
105 self.enable_deprecation_warning()
106 out, err = self.run_bzr('status', working_dir='foo')
107 self.check_warning(False)
108
109 def test_repository_deprecation_warning_suppressed_branch(self):
110 """Old formats give a warning"""
111 tree = self.make_obsolete_repo('foo')
112 conf = tree.branch.get_config()
113 conf.set_user_option('suppress_warnings', 'format_deprecation')
114 self.enable_deprecation_warning()
115 out, err = self.run_bzr('status', working_dir='foo')
116 self.check_warning(False)
62117
63118
=== modified file 'bzrlib/tests/test_config.py'
--- bzrlib/tests/test_config.py 2009-10-31 01:43:48 +0000
+++ bzrlib/tests/test_config.py 2009-12-16 10:09:27 +0000
@@ -369,6 +369,14 @@
369369
370class TestIniConfig(tests.TestCase):370class TestIniConfig(tests.TestCase):
371371
372 def make_config_parser(self, s):
373 conf = config.IniBasedConfig(None)
374 parser = conf._get_parser(file=StringIO(s.encode('utf-8')))
375 return conf, parser
376
377
378class TestIniConfigBuilding(TestIniConfig):
379
372 def test_contructs(self):380 def test_contructs(self):
373 my_config = config.IniBasedConfig("nothing")381 my_config = config.IniBasedConfig("nothing")
374382
@@ -385,20 +393,53 @@
385 parser = my_config._get_parser(file=config_file)393 parser = my_config._get_parser(file=config_file)
386 self.failUnless(my_config._get_parser() is parser)394 self.failUnless(my_config._get_parser() is parser)
387395
396
397class TestGetUserOptionAs(TestIniConfig):
398
388 def test_get_user_option_as_bool(self):399 def test_get_user_option_as_bool(self):
389 config_file = StringIO("""400 conf, parser = self.make_config_parser("""
390a_true_bool = true401a_true_bool = true
391a_false_bool = 0402a_false_bool = 0
392an_invalid_bool = maybe403an_invalid_bool = maybe
393a_list = hmm, who knows ? # This interpreted as a list !404a_list = hmm, who knows ? # This is interpreted as a list !
394""".encode('utf-8'))405""")
395 my_config = config.IniBasedConfig(None)406 get_bool = conf.get_user_option_as_bool
396 parser = my_config._get_parser(file=config_file)407 self.assertEqual(True, get_bool('a_true_bool'))
397 get_option = my_config.get_user_option_as_bool408 self.assertEqual(False, get_bool('a_false_bool'))
398 self.assertEqual(True, get_option('a_true_bool'))409 self.assertIs(None, get_bool('an_invalid_bool'))
399 self.assertEqual(False, get_option('a_false_bool'))410 self.assertIs(None, get_bool('not_defined_in_this_config'))
400 self.assertIs(None, get_option('an_invalid_bool'))411
401 self.assertIs(None, get_option('not_defined_in_this_config'))412
413 def test_get_user_option_as_list(self):
414 conf, parser = self.make_config_parser("""
415a_list = a,b,c
416length_1 = 1,
417one_item = x
418""")
419 get_list = conf.get_user_option_as_list
420 self.assertEqual(['a', 'b', 'c'], get_list('a_list'))
421 self.assertEqual(['1'], get_list('length_1'))
422 self.assertEqual('x', conf.get_user_option('one_item'))
423 # automatically cast to list
424 self.assertEqual(['x'], get_list('one_item'))
425
426
427class TestSupressWarning(TestIniConfig):
428
429 def make_warnings_config(self, s):
430 conf, parser = self.make_config_parser(s)
431 return conf.suppress_warning
432
433 def test_suppress_warning_unknown(self):
434 suppress_warning = self.make_warnings_config('')
435 self.assertEqual(False, suppress_warning('unknown_warning'))
436
437 def test_suppress_warning_known(self):
438 suppress_warning = self.make_warnings_config('suppress_warnings=a,b')
439 self.assertEqual(False, suppress_warning('c'))
440 self.assertEqual(True, suppress_warning('a'))
441 self.assertEqual(True, suppress_warning('b'))
442
402443
403class TestGetConfig(tests.TestCase):444class TestGetConfig(tests.TestCase):
404445