Skip repository tests when the SCM client command is unavailable (#42500).

Patch by Go MAEDA (user:maeda).


git-svn-id: https://svn.redmine.org/redmine/trunk@23618 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2025-04-10 09:42:10 +00:00
parent 2bc72f1823
commit 1e9f1229e6
17 changed files with 21 additions and 13 deletions

View File

@@ -37,6 +37,7 @@ class RepositoriesBazaarControllerTest < Redmine::RepositoryControllerTest
:log_encoding => 'UTF-8'
)
assert @repository
skip "SCM command is unavailable" unless @repository.class.scm_available
end
if File.directory?(REPOSITORY_PATH)

View File

@@ -186,6 +186,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest
def test_show_without_main_repository_should_display_first_repository
skip unless repository_configured?('subversion')
skip unless Repository::Subversion.scm_available
project = Project.find(1)
repos = project.repositories
@@ -208,6 +209,7 @@ class RepositoriesControllerTest < Redmine::RepositoryControllerTest
def test_show_should_show_diff_button_depending_on_browse_repository_permission
skip unless repository_configured?('subversion')
skip unless Repository::Subversion.scm_available
@request.session[:user_id] = 2
role = Role.find(1)

View File

@@ -40,6 +40,7 @@ class RepositoriesCvsControllerTest < Redmine::RepositoryControllerTest
:url => MODULE_NAME,
:log_encoding => 'UTF-8')
assert @repository
skip "SCM command is unavailable" unless @repository.class.scm_available
end
if File.directory?(REPOSITORY_PATH)

View File

@@ -41,6 +41,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest
:path_encoding => 'ISO-8859-1'
)
assert @repository
skip "SCM command is unavailable" unless @repository.class.scm_available
end
def test_create_and_update

View File

@@ -37,6 +37,8 @@ class RepositoriesMercurialControllerTest < Redmine::RepositoryControllerTest
:path_encoding => 'ISO-8859-1'
)
assert @repository
skip "SCM command is unavailable" unless @repository.class.scm_available
@diff_c_support = true
end

View File

@@ -34,6 +34,7 @@ class RepositoriesSubversionControllerTest < Redmine::RepositoryControllerTest
@repository = Repository::Subversion.create(:project => @project,
:url => self.class.subversion_repository_url)
assert @repository
skip "SCM command is unavailable" unless @repository.class.scm_available
end
if repository_configured?('subversion')

View File

@@ -35,6 +35,7 @@ class RepositoriesGitTest < Redmine::IntegrationTest
:path_encoding => 'ISO-8859-1'
)
assert @repository
skip "SCM command is unavailable" unless @repository.class.scm_available
end
if File.directory?(REPOSITORY_PATH)

View File

@@ -27,6 +27,7 @@ class BazaarAdapterTest < ActiveSupport::TestCase
def setup
@adapter = Redmine::Scm::Adapters::BazaarAdapter.
new(File.join(REPOSITORY_PATH, "trunk"))
skip "SCM command is unavailable" unless @adapter.class.client_available
end
def test_scm_version

View File

@@ -27,6 +27,7 @@ class CvsAdapterTest < ActiveSupport::TestCase
if File.directory?(REPOSITORY_PATH)
def setup
@adapter = Redmine::Scm::Adapters::CvsAdapter.new(MODULE_NAME, REPOSITORY_PATH)
skip "SCM command is unavailable" unless @adapter.class.client_available
end
def test_scm_version

View File

@@ -42,13 +42,6 @@ class GitAdapterTest < ActiveSupport::TestCase
WINDOWS_SKIP_STR = "TODO: This test fails in Git for Windows above 1.7.10"
def setup
adapter_class = Redmine::Scm::Adapters::GitAdapter
assert adapter_class
assert adapter_class.client_command
assert_equal true, adapter_class.client_available
assert_equal true, adapter_class.client_version_above?([1])
assert_equal true, adapter_class.client_version_above?([1, 0])
@adapter =
Redmine::Scm::Adapters::GitAdapter.
new(
@@ -59,6 +52,8 @@ class GitAdapterTest < ActiveSupport::TestCase
'ISO-8859-1'
)
assert @adapter
skip "SCM is unavailable" unless @adapter.class.client_available
@char_1 = 'Ü'
@str_felix_hex = "Felix Sch\xC3\xA4fer".b
end

View File

@@ -30,12 +30,6 @@ class MercurialAdapterTest < ActiveSupport::TestCase
if File.directory?(REPOSITORY_PATH)
def setup
adapter_class = Redmine::Scm::Adapters::MercurialAdapter
assert adapter_class
assert adapter_class.client_command
assert_equal true, adapter_class.client_available
assert_equal true, adapter_class.client_version_above?([0, 9, 5])
@adapter =
Redmine::Scm::Adapters::MercurialAdapter.new(
REPOSITORY_PATH,
@@ -44,6 +38,8 @@ class MercurialAdapterTest < ActiveSupport::TestCase
nil,
'ISO-8859-1'
)
skip "SCM command is unavailable" unless @adapter.class.client_available
@diff_c_support = true
@char_1 = 'Ü'
@tag_char_1 = 'tag-Ü-00'

View File

@@ -23,6 +23,7 @@ class SubversionAdapterTest < ActiveSupport::TestCase
if repository_configured?('subversion')
def setup
@adapter = Redmine::Scm::Adapters::SubversionAdapter.new(self.class.subversion_repository_url)
skip "SCM command is unavailable" unless @adapter.class.client_available
end
def test_client_version

View File

@@ -50,6 +50,7 @@ class RepositoryBazaarTest < ActiveSupport::TestCase
:log_encoding => 'UTF-8'
)
assert @repository
skip "SCM command is unavailable" unless @repository.class.scm_available
end
def test_blank_path_to_repository_error_message

View File

@@ -36,6 +36,7 @@ class RepositoryCvsTest < ActiveSupport::TestCase
:url => MODULE_NAME,
:log_encoding => 'UTF-8')
assert @repository
skip "SCM command is unavailable" unless @repository.class.scm_available
end
def test_blank_module_error_message

View File

@@ -41,6 +41,7 @@ class RepositoryGitTest < ActiveSupport::TestCase
:path_encoding => 'ISO-8859-1'
)
assert @repository
skip "SCM command is unavailable" unless @repository.class.scm_available
end
def test_nondefault_repo_with_blank_identifier_destruction

View File

@@ -35,6 +35,7 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
:path_encoding => 'ISO-8859-1'
)
assert @repository
skip "SCM command is unavailable" unless @repository.class.scm_available
end
def test_blank_path_to_repository_error_message

View File

@@ -30,6 +30,7 @@ class RepositorySubversionTest < ActiveSupport::TestCase
@repository = Repository::Subversion.create(:project => @project,
:url => self.class.subversion_repository_url)
assert @repository
skip "SCM command is unavailable" unless @repository.class.scm_available
end
def test_invalid_url