pulp/pulp-cli

Version constrain `>=x.y.z` doesn't include unreleased plugin code `x.y.z.dev` on tests

Closed this issue · 2 comments

Summary

When writting a test for a plugin that contains a version constrains >=x.y.z, the test won't recognize x.y.z.dev as being part of that constrain specification.

Steps to reproduce

Create a test file and run it with pytest:

from pulp_glue.common.context import PluginRequirement

def test_dev_version_gte_base_version():
    plugin_requirement = PluginRequirement("plugin", specifier=">=3.25.0")
    assert "3.25.0" in plugin_requirement # succeeds
    assert "3.25.0.dev" in plugin_requirement # fails

Expected behavior

Unreleased version (developer versions) of those constrains to be recognized as part of the case specification.

Pulp and pulp-cli version info

pulpcore: 3.42.0.dev
pulp-cli: 0.23.0.dev0

Additonal context

When some feature will be added or removed from a plugin, often this should be reflected in the CLI.
It would be convenient to allow testing those changes as if they were released, without having to wait the real release.

If that's not something desirable at all, we could add that in the docs to clarify one should wait the plugin changes to be released before doing in the CLI.

This is working as designed. We are following pythons version sorting here.
If you want to include dev versions, you can specify the requirement with ".dev". But they are inherently dangerous, because the same dev-version may look different before and after a merge.

Yeah, I see your point.
I will propose some small doc improvements to clarify this fact, then.