jenkins-bot has submitted this change and it was merged.
Change subject: Revert "[FIX] ParamInfo: Correctly initialize ParamInfo" ......................................................................
Revert "[FIX] ParamInfo: Correctly initialize ParamInfo"
This reverts commit 8f2fba2bf65947a849175c8ca95901cf15b9f4a2.
Bug: T109168 Change-Id: Ifc3f5fa492cda7f6b650a9cbab83b04cc98d7ea7 --- M pywikibot/data/api.py M tests/api_tests.py 2 files changed, 7 insertions(+), 29 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py index a7b7f6d..c50e46d 100644 --- a/pywikibot/data/api.py +++ b/pywikibot/data/api.py @@ -551,15 +551,13 @@ # query modules can be prefixed with 'query+' self._init()
- if self._action_modules: - # The query module may be added before the action modules have been - if 'query' in self._modules: - # It does fetch() while initializing, and this method can't be - # called before it's initialized. - modules = self._normalize_modules(modules) - else: - # At least we do know the valid action modules and require a subset - assert not modules - self._action_modules - self.root_modules + if 'query' in self._modules: + # It does fetch() while initializing, and this method can't be + # called before it's initialized. + modules = self._normalize_modules(modules) + elif self._action_modules: + # At least we do know the valid action modules and require a subset + assert not modules - self._action_modules - self.root_modules
self._fetch(modules)
diff --git a/tests/api_tests.py b/tests/api_tests.py index 2a76405..213cf3b 100644 --- a/tests/api_tests.py +++ b/tests/api_tests.py @@ -163,26 +163,6 @@ self.assertIn('info', pi.query_modules) self.assertIn('login', pi._action_modules)
- def test_init_query_first(self): - """Test init where it first adds query and then main.""" - def patched_generate_submodules(modules): - # Change the query such that query is handled before main - modules = set(modules) - if 'main' in modules: - assert 'query' in modules - modules.discard('main') - modules = list(modules) + ['main'] - else: - assert 'query' not in modules - original_generate_submodules(modules) - pi = api.ParamInfo(self.site, set(['query', 'main'])) - self.assertEqual(len(pi), 0) - original_generate_submodules = pi._generate_submodules - pi._generate_submodules = patched_generate_submodules - pi._init() - self.assertIn('main', pi._paraminfo) - self.assertIn('query', pi._paraminfo) - def test_init_pageset(self): site = self.get_site() self.assertNotIn('query', api.ParamInfo.init_modules)
pywikibot-commits@lists.wikimedia.org