Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python: Quarantine slow tests into their own CI run #4558

Merged
merged 1 commit into from
Dec 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
- { path: nuget, name: nuget }
- { path: omnibus, name: omnibus }
- { path: python, name: python }
- { path: python, name: python_slow }
- { path: terraform, name: terraform }
env:
BASE_IMAGE: ubuntu:18.04
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
let(:generated_fixture_name) { "pip_compile_imports_setup.txt" }
let(:setup_fixture_name) { "small.py" }

it "updates the requirements.txt" do
it "updates the requirements.txt", :slow do
expect(updated_files.count).to eq(1)
expect(updated_files.first.content).to include("attrs==18.1.0")
expect(updated_files.first.content).
Expand All @@ -235,7 +235,7 @@
expect(updated_files.first.content).to_not include("--hash=sha")
end

context "that needs sanitizing" do
context "that needs sanitizing", :slow do
let(:setup_fixture_name) { "small_needs_sanitizing.py" }
it "updates the requirements.txt" do
expect(updated_files.count).to eq(1)
Expand Down Expand Up @@ -497,7 +497,7 @@
let(:dependency_requirements) { [] }
let(:dependency_previous_requirements) { [] }

it "raises an error indicating the dependencies are not resolvable" do
it "raises an error indicating the dependencies are not resolvable", :slow do
expect { updated_files }.to raise_error(Dependabot::DependencyFileNotResolvable) do |err|
expect(err.message).to include(
"There are incompatible versions in the resolved dependencies:\n pyyaml==5.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
)
end

it "updates both files correctly" do
it "updates both files correctly", :slow do
expect(updated_files.map(&:name)).to eq(%w(Pipfile Pipfile.lock))

updated_lockfile = updated_files.find { |f| f.name == "Pipfile.lock" }
Expand Down Expand Up @@ -310,7 +310,7 @@
let(:lockfile_fixture_name) { "git_source_no_ref.lock" }

context "when updating the non-git dependency" do
it "doesn't update the git dependency" do
it "doesn't update the git dependency", :slow do
expect(json_lockfile["default"]["requests"]["version"]).
to eq("==2.18.4")
expect(json_lockfile["default"]["pythonfinder"]).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@
}]
end

it "raises a helpful error" do
it "raises a helpful error", :slow do
expect { subject }.
to raise_error(Dependabot::DependencyFileNotResolvable) do |error|
expect(error.message).
Expand Down Expand Up @@ -337,7 +337,7 @@
it { is_expected.to be >= Gem::Version.new("40.6.2") }
end

context "with an import of the setup.py" do
context "with an import of the setup.py", :slow do
let(:dependency_files) do
[manifest_file, generated_file, setup_file, pyproject]
end
Expand Down Expand Up @@ -375,7 +375,7 @@
end
end

context "with native dependencies that are not pre-built" do
context "with native dependencies that are not pre-built", :slow do
let(:manifest_fixture_name) { "native_dependencies.in" }
let(:generated_fixture_name) { "pip_compile_native_dependencies.txt" }
let(:dependency_name) { "cryptography" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@
end
end

context "for a resolution that has caused trouble in the past" do
context "for a resolution that has caused trouble in the past", :slow do
let(:dependency_files) { [pipfile] }
let(:pipfile_fixture_name) { "problematic_resolution" }
let(:dependency_name) { "twilio" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
it { is_expected.to eq(Gem::Version.new("2.15.1")) }
end

context "resolvable only if git references are preserved" do
context "resolvable only if git references are preserved", :slow do
let(:pyproject_fixture_name) { "git_conflict.toml" }
let(:lockfile_fixture_name) { "git_conflict.lock" }
let(:dependency_name) { "django-widget-tweaks" }
Expand Down
18 changes: 18 additions & 0 deletions python/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,21 @@ def require_common_spec(path)
end

require "#{common_dir}/spec/spec_helper.rb"

module SlowTestHelper
def self.slow_tests?
ENV["SUITE_NAME"] == "python_slow"
end
end

RSpec.configure do |config|
config.around do |example|
if SlowTestHelper.slow_tests? && example.metadata[:slow]
example.run
elsif !SlowTestHelper.slow_tests? && !example.metadata[:slow]
example.run
else
example.skip
end
end
end