Dalba created this task.
Dalba added projects: Pywikibot-core, Pywikibot-tests.
Herald added subscribers: pywikibot-bugs-list, Aklapper.

TASK DESCRIPTION

https://travis-ci.org/wikimedia/pywikibot/jobs/384307761#L2029

self = <pywikibot.bot.CreatingPageBot object at 0x7f37c84da908>
    def run(self):
        """Process all pages in generator."""
        self._start_ts = pywikibot.Timestamp.now()
        if not hasattr(self, 'generator'):
            raise NotImplementedError('Variable %s.generator not set.'
                                      % self.__class__.__name__)
    
        maxint = 0
        if PY2:
            maxint = sys.maxint
    
            # Python 2 does not clear previous exceptions and method `exit`
            # relies on sys.exc_info returning exceptions occurring in `run`.
            sys.exc_clear()
        self.setup()
        try:
            for page in self.generator:
                # preprocessing of the page
                try:
                    self.init_page(page)
                except SkipPageError as e:
                    issue_deprecation_warning('Use of SkipPageError',
                                              'BaseBot.skip_page() method', 2)
                    pywikibot.warning('Skipped "{0}" due to: {1}'.format(
                                      page, e.reason))
                    if PY2:
                        # Python 2 does not clear the exception and it may seem
                        # that the generator stopped due to an exception
                        sys.exc_clear()
                    continue
    
>               if self.skip_page(page):
pywikibot/bot.py:1466: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <pywikibot.bot.CreatingPageBot object at 0x7f37c84da908>
page = Page('Q1')
    def skip_page(self, page):
        """Treat page if doesn't exist."""
        if page.exists():
            pywikibot.warning(
                'Page "{page.title()}" does already exist on {page.site}.'
>               .format(page=page))
pywikibot/bot.py:1789: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = Page('Q1'), name = 'title()'
    def __getattr__(self, name):
        """Generic disabled method warnings."""
        if name in ('removeImage', 'replaceImage'):
            warn('Page.{0}() is no longer supported.'.format(name),
                 _NotImplementedWarning, 2)
            return lambda x: None
        raise AttributeError("'{0}' object has no attribute '{1}'"
>                            .format(self.__class__.__name__, name))
E       AttributeError: 'Page' object has no attribute 'title()'
pywikibot/page.py:2241: AttributeError
During handling of the above exception, another exception occurred:
self = <tests.bot_tests.LiveBotTestCase testMethod=test_CreatingPageBot>
    def test_CreatingPageBot(self):
        """Test CreatingPageBot class."""
        # This doesn't verify much (e.g. it could yield the first existing page)
        # but the assertion in post_treat should verify that the page is valid
        def treat_generator():
            """Yield just one current page (the last one)."""
            yield self._current_page
    
        def post_treat(page):
            """Verify the page is missing."""
            self.assertFalse(page.exists())
    
        self._treat_site = None
        self.bot = pywikibot.bot.CreatingPageBot(
            generator=self._missing_generator())
        self.bot.treat_page = self._treat_page(treat_generator(), post_treat)
        self.bot.exit = self._exit()
>       self.bot.run()
tests/bot_tests.py:364: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pywikibot/bot.py:1488: in run
    self.exit()
tests/bot_tests.py:331: in exit
    super(LiveBotTestCase, self)._exit(t, written, exception)()
tests/bot_tests.py:166: in exit
    self.assertEqual(self.bot._treat_counter, treated)
E   AssertionError: 0 != 1
------------------------------ Captured log call -------------------------------
logging.py                 109 VERBOSE  Found 1 wikidata:wikidata processes running, including this one.
connectionpool.py          396 DEBUG    https://www.wikidata.org:443 "GET /w/api.php?action="" HTTP/1.1" 200 830
connectionpool.py          396 DEBUG    https://www.wikidata.org:443 "GET /w/api.php?gapfrom=%21&prop=info%7Cimageinfo%7Ccategoryinfo&inprop=protection&iiprop=timestamp%7Cuser%7Ccomment%7Curl%7Csize%7Csha1%7Cmetadata&iilimit=max&generator=allpages&action="" HTTP/1.1" 200 323
_____________________ LiveBotTestCase.test_ExistingPageBot _____________________
self = <pywikibot.bot.ExistingPageBot object at 0x7f37c845f438>
    def run(self):
        """Process all pages in generator."""
        self._start_ts = pywikibot.Timestamp.now()
        if not hasattr(self, 'generator'):
            raise NotImplementedError('Variable %s.generator not set.'
                                      % self.__class__.__name__)
    
        maxint = 0
        if PY2:
            maxint = sys.maxint
    
            # Python 2 does not clear previous exceptions and method `exit`
            # relies on sys.exc_info returning exceptions occurring in `run`.
            sys.exc_clear()
        self.setup()
        try:
            for page in self.generator:
                # preprocessing of the page
                try:
                    self.init_page(page)
                except SkipPageError as e:
                    issue_deprecation_warning('Use of SkipPageError',
                                              'BaseBot.skip_page() method', 2)
                    pywikibot.warning('Skipped "{0}" due to: {1}'.format(
                                      page, e.reason))
                    if PY2:
                        # Python 2 does not clear the exception and it may seem
                        # that the generator stopped due to an exception
                        sys.exc_clear()
                    continue
    
>               if self.skip_page(page):
pywikibot/bot.py:1466: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <pywikibot.bot.ExistingPageBot object at 0x7f37c845f438>
page = Page('Q1X')
    def skip_page(self, page):
        """Treat page if it exists and handle NoPage from it."""
        if not page.exists():
            pywikibot.warning(
                'Page "{page.title()}" does not exist on {page.site}.'
>               .format(page=page))
pywikibot/bot.py:1764: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = Page('Q1X'), name = 'title()'
    def __getattr__(self, name):
        """Generic disabled method warnings."""
        if name in ('removeImage', 'replaceImage'):
            warn('Page.{0}() is no longer supported.'.format(name),
                 _NotImplementedWarning, 2)
            return lambda x: None
        raise AttributeError("'{0}' object has no attribute '{1}'"
>                            .format(self.__class__.__name__, name))
E       AttributeError: 'Page' object has no attribute 'title()'
pywikibot/page.py:2241: AttributeError
During handling of the above exception, another exception occurred:
self = <tests.bot_tests.LiveBotTestCase testMethod=test_ExistingPageBot>
    def test_ExistingPageBot(self):
        """Test ExistingPageBot class."""
        def post_treat(page):
            """Verify the page exists."""
            self.assertTrue(page.exists())
    
        self._treat_site = None
        self.bot = pywikibot.bot.ExistingPageBot(
            generator=self._missing_generator())
        self.bot.treat_page = self._treat_page(post_treat=post_treat)
        self.bot.exit = self._exit()
>       self.bot.run()
tests/bot_tests.py:345: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pywikibot/bot.py:1488: in run
    self.exit()
tests/bot_tests.py:331: in exit
    super(LiveBotTestCase, self)._exit(t, written, exception)()
tests/bot_tests.py:166: in exit
    self.assertEqual(self.bot._treat_counter, treated)
E   AssertionError: 1 != 2

TASK DETAIL
https://phabricator.wikimedia.org/T195696

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Dalba
Cc: Aklapper, pywikibot-bugs-list, Dalba, Magul, Tbscho, MayS, Mdupont, JJMC89, Avicennasis, jayvdb, Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
pywikibot-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to