Page MenuHomePhabricator

import unittest module directly
Closed, ResolvedPublic

Description

Introduction

Before dropping Python 2 support with Pywikibot unittests2 was used for Python 2 tests due to T106512 but Standard unittest for Python 3 tests. Therefore unittest was always imported from tests.aspects which imported it from tests. Now it is no longer necessary to import unittest module from tests.aspects or from tests.

What to do:

  • replace all occurences of from tests.aspects import unittest with import unittest
  • replace all occurences of from tests import unittest with import unittest
  • Update date in copyright string from 2020 to 2021

The issues can be found here

Important hints

import re
import unittest

import pywikibot

from tests.aspects import testCase

Event Timeline

Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald Transcript
Xqt triaged this task as Low priority.Jan 17 2021, 9:18 AM

Change 656609 had a related patch set uploaded (by Homeboy 445; owner: Homeboy 445):
[pywikibot/core@master] Changed import preference for unittest in certain scripts

https://gerrit.wikimedia.org/r/656609

Change 656609 merged by jenkins-bot:
[pywikibot/core@master] Changed import preference for unittest in certain scripts

https://gerrit.wikimedia.org/r/656609

@GShriya; There are remainung issues to be solved. Are you still interesting to work on it?

Yes sir. Can you please give me a brief idea about the remaining issues to be solved?

Yes sir. Can you please give me a brief idea about the remaining issues to be solved?

See the description above and the merged patch as a sample. The remaining issues can be found at https://codesearch.wmcloud.org/pywikibot/?q=from%20tests(%5C.aspects)%3F%20import%20unittest&i=nope&files=&excludeFiles=&repos= What do you need to know additionally?

Nothing sir. I am working on this

GShriya subscribed.

Change 664312 had a related patch set uploaded (by Homeboy 445; owner: Homeboy 445):
[pywikibot/core@master] Change Import Preference for unittest module

https://gerrit.wikimedia.org/r/664312

Change 664312 merged by jenkins-bot:
[pywikibot/core@master] Change Import Preference for unittest module

https://gerrit.wikimedia.org/r/664312

Xqt assigned this task to Homeboy_445.
Xqt removed a project: Patch-For-Review.

Change 664582 had a related patch set uploaded (by Homeboy 445; owner: Homeboy 445):
[pywikibot/core@master] Changes import preferences for unittest

https://gerrit.wikimedia.org/r/664582

Change 664582 merged by jenkins-bot:
[pywikibot/core@master] Changes import preferences for unittest

https://gerrit.wikimedia.org/r/664582