Skip to content

Commit

Permalink
Test that unsupported Python versions raise the expected error
Browse files Browse the repository at this point in the history
Since we'll be dropping 3.6/3.7 soon, we want to ensure that users on
unsupported python versions get a clearly understandable error and not a
random traceback.
  • Loading branch information
jeffwidman committed Aug 1, 2023
1 parent 4f0c2fa commit e4d695e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions python/spec/dependabot/python/update_checker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,22 @@

it { is_expected.to eq(Gem::Version.new("3.2.4")) }

context "that disallows the latest version" do
let(:python_version_content) { "3.5.3\n" }
context "that is set to the oldest version of python supported by Dependabot" do
let(:python_version_content) { "3.6.0\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 Dependabot::DependencyFileNotResolvable error" do
expect { checker.latest_resolvable_version }.
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

Expand Down

0 comments on commit e4d695e

Please sign in to comment.