diff --git a/src/main/python/pybuilder/core.py b/src/main/python/pybuilder/core.py index 51fd170f3..136a42eb7 100644 --- a/src/main/python/pybuilder/core.py +++ b/src/main/python/pybuilder/core.py @@ -239,7 +239,7 @@ def __init__(self, name, version=None, url=None): try: version = str(SpecifierSet(version)) except InvalidSpecifier: - raise ValueError("'%s' must be either PEP 0440 version or a version specifier set") + raise ValueError("'%s' must be either PEP 0440 version or a version specifier set" % version) self.version = version self.url = url diff --git a/src/unittest/python/plugins/python/install_dependencies_plugin_tests.py b/src/unittest/python/plugins/python/install_dependencies_plugin_tests.py index a00e12353..7f6b084d8 100644 --- a/src/unittest/python/plugins/python/install_dependencies_plugin_tests.py +++ b/src/unittest/python/plugins/python/install_dependencies_plugin_tests.py @@ -204,6 +204,9 @@ def test_should_install_dependency_with_version_and_operator(self, exec_command, exec_command( PIP_EXEC_STANZA + ["install", 'spam==0.1.2'], ANY, env=ANY, shell=False) + def test_should_install_dependency_with_wrong_version_and_operator(self): + self.assertRaises(ValueError, Dependency, "spam", "~=1") + @patch("pybuilder.plugins.python.install_dependencies_plugin.create_constraint_file") @patch("pybuilder.plugins.python.install_dependencies_plugin.get_package_version", return_value={}) @patch("pybuilder.plugins.python.install_dependencies_plugin.execute_command", return_value=0)