jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1335060?usp=email )
Change subject: tests: Fix upload offset mismatch test
......................................................................
tests: Fix upload offset mismatch test
The test captured a stashed chunk but started a fresh upload without
passing its file key or altered offset. Resume the stash explicitly so
the test reaches the intended offset validation.
Bug: T367316
Change-Id: Id08384e6297c2716e0c35376222d0f2e622a53e1
---
M tests/upload_tests.py
1 file changed, 10 insertions(+), 2 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/tests/upload_tests.py b/tests/upload_tests.py
index a4397b3..7cd413a 100755
--- a/tests/upload_tests.py
+++ b/tests/upload_tests.py
@@ -444,13 +444,21 @@
"""Test a first chunk is stashed after an upload warning."""
self._init_upload(1024)
- @unittest.expectedFailure # T367316
def test_offset_mismatch(self) -> None:
"""Test trying to continue with a different offset."""
self._init_upload(1024)
self._offset = 0
+ # Resume the captured stash instead of starting a fresh upload.
+ page = pywikibot.FilePage(self.site, 'MP_sounds-pwb.png')
+ uploader = Uploader(
+ self.site, page, source_filename=self.sounds_png,
+ comment='pywikibot test', text=page.text,
+ chunk_size=1024, ignore_warnings=True,
+ report_success=False)
with self.assertRaises(ValueError) as cm:
- self._finish_upload(1024, self.sounds_png)
+ uploader._upload(
+ ignore_warnings=True, report_success=False,
+ file_key=self._file_key, offset=self._offset)
self.assertEqual(
str(cm.exception),
f'For the file key "{self._file_key}" the server reported a size'
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1335060?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Id08384e6297c2716e0c35376222d0f2e622a53e1
Gerrit-Change-Number: 1335060
Gerrit-PatchSet: 3
Gerrit-Owner: Mahveotm <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]