Version source tagging (automatic and manual) for version_added and deprecation versions (#69680)

* Track collection for version_added.
Validate *all* version numbers in validate-modules.
For tagged version numbers (i.e. version_added), consider source collection to chose validation.

* Make tagging/untagging functions more flexible.

* Tag all versions in doc fragments.

* Tag all deprecation versions issued by code.

* Make Display.deprecated() understand tagged versions.

* Extend validation to enforce tagged version numbers.

* Tag versions in tests.

* Lint and fix test.

* Mention collection name in collection loader's deprecation/removal messages.

* Fix error IDs.

* Handle tagged dates in Display.deprecated().

* Also require that removed_at_date and deprecated_aliases.date are tagged.

* Also automatically tag/untag removed_at_date; fix sanity module removal version check.

* Improve error message when invalid version number is used (like '2.14' in collections).
This commit is contained in:
Felix Fontein
2020-05-29 07:46:16 +02:00
committed by GitHub
parent f5f3ba7ab5
commit 40f21dfd3c
60 changed files with 601 additions and 302 deletions

View File

@ -22,23 +22,23 @@ def test_warn(am, capfd):
@pytest.mark.parametrize('stdin', [{}], indirect=['stdin'])
def test_deprecate(am, capfd):
am.deprecate('deprecation1')
am.deprecate('deprecation2', '2.3')
am.deprecate('deprecation3', version='2.4')
am.deprecate('deprecation4', date='2020-03-10')
am.deprecate('deprecation2', 'ansible.builtin:2.3')
am.deprecate('deprecation3', version='ansible.builtin:2.4')
am.deprecate('deprecation4', date='ansible.builtin:2020-03-10')
with pytest.raises(SystemExit):
am.exit_json(deprecations=['deprecation5', ('deprecation6', '2.4')])
am.exit_json(deprecations=['deprecation5', ('deprecation6', 'ansible.builtin:2.4')])
out, err = capfd.readouterr()
output = json.loads(out)
assert ('warnings' not in output or output['warnings'] == [])
assert output['deprecations'] == [
{u'msg': u'deprecation1', u'version': None},
{u'msg': u'deprecation2', u'version': '2.3'},
{u'msg': u'deprecation3', u'version': '2.4'},
{u'msg': u'deprecation4', u'date': '2020-03-10'},
{u'msg': u'deprecation2', u'version': 'ansible.builtin:2.3'},
{u'msg': u'deprecation3', u'version': 'ansible.builtin:2.4'},
{u'msg': u'deprecation4', u'date': 'ansible.builtin:2020-03-10'},
{u'msg': u'deprecation5', u'version': None},
{u'msg': u'deprecation6', u'version': '2.4'},
{u'msg': u'deprecation6', u'version': 'ansible.builtin:2.4'},
]