jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1205924?usp=email )

Change subject: Tests: allow Python pre-releases in version.py package path 
check
......................................................................

Tests: allow Python pre-releases in version.py package path check

- Raise RuntimeError instead of AssertionError for stable Python versions
- For development Python releases, debug the duplicate package path

Bug: T409660
Change-Id: I9cdadf37c0fe98bac4b008529e90791d05611470
---
M pywikibot/version.py
1 file changed, 10 insertions(+), 5 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/version.py b/pywikibot/version.py
index f9c4460..bc93788 100644
--- a/pywikibot/version.py
+++ b/pywikibot/version.py
@@ -348,12 +348,17 @@
                 path = _file

             info['path'] = path
-            assert path not in paths, (
-                f'Path {path} of the package {name} is in defined paths as '
-                f'{paths[path]}'
-            )
+            if path in paths:
+                msg = (
+                    f'Path {path} of the package {name} is already in defined '
+                    f'paths as {paths[path]}'
+                )
+                if sys.version_info.releaselevel == 'final':
+                    raise RuntimeError(msg)

-            paths[path] = name
+                pywikibot.debug(msg)
+            else:
+                paths[path] = name

         if '__version__' in package.__dict__:
             info['ver'] = package.__version__

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1205924?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: I9cdadf37c0fe98bac4b008529e90791d05611470
Gerrit-Change-Number: 1205924
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[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]

Reply via email to