jenkins-bot merged this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
Suppress ArgumentDeprecationWarning in test_immutable_namespaces_on_read

Also fix the stacklevel in pagegenerators.GeneratorFactory._handle_namespaces.

Change-Id: Id93d28b7119afc0168fa86fe4a659dfcdc7b228c
---
M pywikibot/pagegenerators.py
M tests/pagegenerators_tests.py
2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index ab81b8d..9f7538c 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -835,7 +835,7 @@
if isinstance(self._namespaces, frozenset):
warn('Cannot handle arg -namespaces as namespaces can not '
'be altered after a generator is created.',
- ArgumentDeprecationWarning, 2)
+ ArgumentDeprecationWarning, 3)
return True
if not value:
value = pywikibot.input('What namespace are you filtering on?')
diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index bcc7afc..927a8a3 100755
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -653,7 +653,13 @@
gf.handleArg('-ns:1,6')
self.assertEqual(gf.namespaces, {1, 6})
self.assertIsInstance(gf.namespaces, frozenset)
- gf.handleArg('-ns:0')
+ with suppress_warnings(
+ 'Cannot handle arg -namespaces as namespaces can not be altered '
+ 'after a generator is created.',
+ pywikibot.exceptions.ArgumentDeprecationWarning
+ ):
+ gf.handleArg('-ns:0')
+
self.assertEqual(gf.namespaces, {1, 6})

def test_unsupported_quality_level_filter(self):

To view, visit change 440721. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Id93d28b7119afc0168fa86fe4a659dfcdc7b228c
Gerrit-Change-Number: 440721
Gerrit-PatchSet: 1
Gerrit-Owner: Dalba <dalba.wiki@gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444@gmail.com>
Gerrit-Reviewer: jenkins-bot