jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/787871 )
Change subject: [tests] Fix for file_tests.TestShareFiles.test_on_both ......................................................................
[tests] Fix for file_tests.TestShareFiles.test_on_both
also update test method identifiers
Bug: T307273 Change-Id: Ia558d292ba3788bc8c7a3215490bd4b3a2a89700 --- M tests/file_tests.py M tox.ini 2 files changed, 13 insertions(+), 14 deletions(-)
Approvals: Xqt: Verified; Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/file_tests.py b/tests/file_tests.py index 001a40c..5293292 100755 --- a/tests/file_tests.py +++ b/tests/file_tests.py @@ -20,7 +20,7 @@ from tests.aspects import TestCase
-class TestShareFiles(TestCase): +class TestSharedFiles(TestCase):
"""Test file_is_shared, exists, fileUrl/get_file_url with shared files."""
@@ -45,7 +45,7 @@
cached = True
- def testSharedOnly(self): + def test_shared_only(self): """Test file_is_shared() on file page with shared file only.""" title = 'File:Sepp Maier 1.JPG'
@@ -73,7 +73,7 @@ .format(title)): itwp_file.get()
- def testLocalOnly(self): + def test_local_only(self): """Test file_is_shared() on file page with local file only.""" title = 'File:Untitled (Three Forms), stainless steel sculpture by ' \ '--James Rosati--, 1975-1976, --Honolulu Academy of Arts--.JPG' @@ -106,28 +106,28 @@ page_doesnt_exist_exc_regex): commons_file.get()
- def testOnBoth(self): + def test_on_both(self): """Test file_is_shared() on file page with local and shared file.""" - title = 'File:Pulsante spam.png' + title = 'Pywikibot MW gear icon.svg'
commons = self.get_site('commons') - itwp = self.get_site('itwiki') - itwp_file = pywikibot.FilePage(itwp, title) - for using in itwp_file.usingPages(): + testwp = self.get_site('testwiki') + testwp_file = pywikibot.FilePage(testwp, title) + for using in testwp_file.usingPages(): self.assertIsInstance(using, pywikibot.Page)
commons_file = pywikibot.FilePage(commons, title)
- self.assertTrue(itwp_file.get_file_url()) - self.assertTrue(itwp_file.exists()) + self.assertTrue(testwp_file.get_file_url()) + self.assertTrue(testwp_file.exists()) self.assertTrue(commons_file.exists())
- self.assertFalse(itwp_file.file_is_shared()) - self.assertTrue(itwp_file.file_is_used) + self.assertFalse(testwp_file.file_is_shared()) + self.assertTrue(testwp_file.file_is_used) self.assertTrue(commons_file.file_is_shared()) self.assertTrue(commons_file.file_is_used)
- def testNonFileLocal(self): + def test_non_file_local(self): """Test file page, without local file, existing on the local wiki.""" title = 'File:Sepp Maier 1.JPG'
diff --git a/tox.ini b/tox.ini index 9fc7bd6..1dec8e0 100644 --- a/tox.ini +++ b/tox.ini @@ -188,7 +188,6 @@ tests/date_tests.py: N802 tests/edit_failure_tests.py: N802 tests/family_tests.py: N802 - tests/file_tests.py: N802 tests/i18n_tests.py: N802 tests/interwiki_link_tests.py: N802 tests/link_tests.py: N802
pywikibot-commits@lists.wikimedia.org