Page MenuHomePhabricator

needs_version decorator
Closed, ResolvedPublic

Description

Some tests require a minimum version of MediaWiki.

It would be nice to have a test decorator for unit test methods, and maybe for entire classes, that skips tests if the version is too low. (or too high?)

The decorator will fail when test class attribute net = False, and dry = True should already avoid communicating with a server as the DrySite provides a dummy method version.

If it skips entire classes, it needs to be aware of T129965.

Some examples of where this might be useful

  • api_tests.TestParamInfo.test_new_mode
  • page_tests.TestPageDeprecation.test_creator (method needs to be split)
  • site_tests.TestSiteObjectDeprecatedFunctions.test_siteinfo_normal_call
  • site_tests.TestSiteGenerators.test_protectedpages_create
  • site_tests.TestRecentChanges.test_pagelist (<= 1.14)
  • site_tests.TestSiteTokens
  • TestSiteInfo.test_siteinfo_v1_16

Event Timeline

Xqt triaged this task as Low priority.Apr 25 2018, 4:01 PM

Change 582299 had a related patch set uploaded (by Dvorapa; owner: Dvorapa):
[pywikibot/core@master] [tests] decorate MW version

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

Xqt subscribed.

TestCase and it’s methods may run for different sites if multiple sites are defined. I think it is too time consuming to implement it (if it would ever work) for only a few methods. Better deprecate support for long time outdated mw versions.

Change 582299 abandoned by Xqt:

[pywikibot/core@master] [tests] decorate MW version

Reason:

see task comment

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

Change 582299 restored by Xqt:

[pywikibot/core@master] [tests] decorate MW version

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

Xqt reopened this task as In Progress.Oct 12 2022, 10:31 AM
Xqt claimed this task.

Change 582299 merged by jenkins-bot:

[pywikibot/core@master] [tests] decorate MW version

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