Maximiliano Bertacchini has proposed merging lp:~maxiberta/launchpad/app-stories-dedup-sitesearch-doctests into lp:launchpad.
Commit message: Run lp.app.stories.launchpad_search.site-search.txt on all search backends. Requested reviews: Launchpad code reviewers (launchpad-reviewers) For more details, see: https://code.launchpad.net/~maxiberta/launchpad/app-stories-dedup-sitesearch-doctests/+merge/343244 Run lp.app.stories.launchpad_search.site-search.txt on all search backends (was lp.app.stories.launchpad_root.site-search.txt). -- Your team Launchpad code reviewers is requested to review the proposed merge of lp:~maxiberta/launchpad/app-stories-dedup-sitesearch-doctests into lp:launchpad.
=== added directory 'lib/lp/app/stories/launchpad-search' === renamed file 'lib/lp/app/stories/launchpad-root/site-search.txt' => 'lib/lp/app/stories/launchpad-search/site-search.txt' === modified file 'lib/lp/app/tests/test_doc.py' --- lib/lp/app/tests/test_doc.py 2011-12-30 09:16:36 +0000 +++ lib/lp/app/tests/test_doc.py 2018-04-13 21:01:49 +0000 @@ -1,4 +1,4 @@ -# Copyright 2010 Canonical Ltd. This software is licensed under the +# Copyright 2010-2018 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). """ @@ -7,8 +7,13 @@ import os +from lp.services.features.testing import FeatureFixture from lp.services.testing import build_test_suite from lp.testing.layers import LaunchpadFunctionalLayer +from lp.testing.pages import ( + PageTestSuite, + setUpGlobs, + ) from lp.testing.systemdocs import ( LayeredDocFileSuite, setUp, @@ -17,6 +22,29 @@ here = os.path.dirname(os.path.realpath(__file__)) +bing_flag = FeatureFixture({'sitesearch.engine.name': 'bing'}) +google_flag = FeatureFixture({'sitesearch.engine.name': 'google'}) + + +def setUp_bing(test): + setUpGlobs(test) + bing_flag.setUp() + + +def setUp_google(test): + setUpGlobs(test) + google_flag.setUp() + + +def tearDown_bing(test): + bing_flag.cleanUp() + tearDown(test) + + +def tearDown_google(test): + google_flag.cleanUp() + tearDown(test) + special = { 'tales.txt': LayeredDocFileSuite( @@ -27,6 +55,21 @@ 'menus.txt': LayeredDocFileSuite( '../doc/menus.txt', layer=None, ), + 'stories/launchpad-search(Bing)': PageTestSuite( + '../stories/launchpad-search/', + id_extensions=['site-search.txt(Bing)'], + setUp=setUp_bing, tearDown=tearDown_bing, + ), + 'stories/launchpad-search(Google)': PageTestSuite( + '../stories/launchpad-search/', + id_extensions=['site-search.txt(Google)'], + setUp=setUp_google, tearDown=tearDown_google, + ), + # Run these doctests again with the default search engine. + '../stories/launchpad-search': PageTestSuite( + '../stories/launchpad-search/', + setUp=setUpGlobs, tearDown=tearDown, + ), } === modified file 'lib/lp/services/testing/__init__.py' --- lib/lp/services/testing/__init__.py 2011-12-30 07:08:24 +0000 +++ lib/lp/services/testing/__init__.py 2018-04-13 21:01:49 +0000 @@ -1,4 +1,4 @@ -# Copyright 2009-2010 Canonical Ltd. This software is licensed under the +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). """ @@ -98,11 +98,12 @@ if not os.path.isdir(full_story_dir): continue story_path = os.path.join(stories_dir, story_dir) + if story_path in special_tests: + continue suite.addTest(PageTestSuite(story_path, package)) # Add the special doctests. - for key in sorted(special_tests): - special_suite = special_tests[key] + for key, special_suite in sorted(special_tests.items()): suite.addTest(special_suite) tests_path = os.path.join(os.path.pardir, 'doc') === modified file 'lib/lp/testing/pages.py' --- lib/lp/testing/pages.py 2017-10-21 18:14:14 +0000 +++ lib/lp/testing/pages.py 2018-04-13 21:01:49 +0000 @@ -1,4 +1,4 @@ -# Copyright 2009-2016 Canonical Ltd. This software is licensed under the +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). """Testing infrastructure for page tests.""" @@ -845,7 +845,7 @@ # but does follow the convention of the other doctest related *Suite() # functions. -def PageTestSuite(storydir, package=None, setUp=setUpGlobs): +def PageTestSuite(storydir, package=None, setUp=setUpGlobs, **kw): """Create a suite of page tests for files found in storydir. :param storydir: the directory containing the page tests. @@ -873,5 +873,5 @@ suite.addTest(LayeredDocFileSuite( paths=paths, package=package, checker=checker, stdout_logging=False, - layer=PageTestLayer, setUp=setUp)) + layer=PageTestLayer, setUp=setUp, **kw)) return suite
_______________________________________________ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp