diff --git a/python/spec/dependabot/python/update_checker/pip_version_resolver_spec.rb b/python/spec/dependabot/python/update_checker/pip_version_resolver_spec.rb index 04328186d34c..ce40865bd1d9 100644 --- a/python/spec/dependabot/python/update_checker/pip_version_resolver_spec.rb +++ b/python/spec/dependabot/python/update_checker/pip_version_resolver_spec.rb @@ -77,14 +77,24 @@ context "with a .python-version file" do let(:dependency_files) { [requirements_file, python_version_file] } - let(:python_version_content) { "3.7.0\n" } - + let(:python_version_content) { "3.11.0\n" } it { is_expected.to eq(Gem::Version.new("3.2.4")) } - context "that disallows the latest version" do + context "that is set to the oldest version of python supported by Dependabot" do let(:python_version_content) { "3.5.3\n" } it { is_expected.to eq(Gem::Version.new("2.2.24")) } end + + context "that is set to a python version no longer supported by Dependabot" do + let(:python_version_content) { "3.4.0\n" } + it "raises a helpful error" do + expect { subject }.to raise_error(Dependabot::DependencyFileNotResolvable) do |err| + expect(err.message).to start_with( + "Dependabot detected the following Python requirement for your project: '3.4.0'." + ) + end + end + end end end @@ -111,23 +121,25 @@ context "with a .python-version file" do let(:dependency_files) { [requirements_file, python_version_file] } - let(:python_version_content) { "3.7.0\n" } + let(:python_version_content) { "3.11.0\n" } it { is_expected.to eq(Gem::Version.new("2.1.1")) } - context "that disallows all fixed versions" do + context "that is set to the oldest version of python supported by Dependabot" do let(:python_version_content) { "3.5.3\n" } - let(:dependency_version) { "3.0.0" } - let(:dependency_requirements) do - [{ - file: "requirements.txt", - requirement: "==3.0.0", - groups: [], - source: nil - }] - end + it { is_expected.to eq(Gem::Version.new("2.1.1")) } + end - it { is_expected.to be_nil } + context "that is set to a python version no longer supported by Dependabot" do + let(:python_version_content) { "3.4.0\n" } + + it "raises a helpful error" do + expect { subject }.to raise_error(Dependabot::DependencyFileNotResolvable) do |err| + expect(err.message).to start_with( + "Dependabot detected the following Python requirement for your project: '3.4.0'." + ) + end + end end end end diff --git a/python/spec/dependabot/python/update_checker/pipenv_version_resolver_spec.rb b/python/spec/dependabot/python/update_checker/pipenv_version_resolver_spec.rb index 0f0f9f6d2fd8..18c39f1c1d21 100644 --- a/python/spec/dependabot/python/update_checker/pipenv_version_resolver_spec.rb +++ b/python/spec/dependabot/python/update_checker/pipenv_version_resolver_spec.rb @@ -208,20 +208,15 @@ end end - context "that is unsupported" do + context "that is set to a python version no longer supported by Dependabot" do let(:pipfile_fixture_name) { "required_python_unsupported" } it "raises a helpful error" do - expect { subject }. - to raise_error(Dependabot::DependencyFileNotResolvable) do |error| - expect(error.message). - to start_with("Dependabot detected the following Python") - expect(error.message).to include("3.4.*") - expect(error.message). - to include( - "supported in Dependabot: 3.11.4, 3.11.3, 3.11.2, 3.11.1, 3.11.0, 3.10.12, 3.10.11, 3.10.10, 3.10.9" - ) - end + expect { subject }.to raise_error(Dependabot::DependencyFileNotResolvable) do |err| + expect(err.message).to start_with( + "Dependabot detected the following Python requirement for your project: '3.4.*'." + ) + end end end diff --git a/python/spec/dependabot/python/update_checker_spec.rb b/python/spec/dependabot/python/update_checker_spec.rb index 312b63312156..e7138baca599 100644 --- a/python/spec/dependabot/python/update_checker_spec.rb +++ b/python/spec/dependabot/python/update_checker_spec.rb @@ -225,9 +225,8 @@ context "that is set to a python version no longer supported by Dependabot" do let(:python_version_content) { "3.4.0\n" } - it "raises a Dependabot::DependencyFileNotResolvable error" do - expect { checker.latest_resolvable_version }. - to raise_error(Dependabot::DependencyFileNotResolvable) do |err| + it "raises a helpful error" do + expect { subject }.to raise_error(Dependabot::DependencyFileNotResolvable) do |err| expect(err.message).to start_with( "Dependabot detected the following Python requirement for your project: '3.4.0'." )