| |
@@ -1055,13 +1055,16 @@
|
| |
self.checkout_branch(git.Repo(self.cloned_repo_path), 'eng-rhel-7')
|
| |
|
| |
cli_cmd = ['rpkg', '--name', 'docpkg', '--path', self.cloned_repo_path, 'lint']
|
| |
+ _run_command.return_value = [0, "version X.X", None]
|
| |
|
| |
with patch('sys.argv', new=cli_cmd):
|
| |
cli = self.new_cli()
|
| |
cli.lint()
|
| |
|
| |
- rpmlint = ['rpmlint', os.path.join(cli.cmd.path, cli.cmd.spec)]
|
| |
- _run_command.assert_called_once_with(rpmlint, shell=True)
|
| |
+ _run_command.assert_has_calls([
|
| |
+ call(['rpmlint', '--version'], return_stdout=True, return_text=True),
|
| |
+ call(['rpmlint', os.path.join(cli.cmd.path, cli.cmd.spec)], shell=True),
|
| |
+ ])
|
| |
|
| |
@patch('pyrpkg.Commands._run_command')
|
| |
def test_lint_warning_with_info(self, _run_command):
|
| |
@@ -1069,13 +1072,16 @@
|
| |
|
| |
cli_cmd = ['rpkg', '--name', 'docpkg', '--path', self.cloned_repo_path,
|
| |
'lint', '--info']
|
| |
+ _run_command.return_value = [0, "version X.X", None]
|
| |
|
| |
with patch('sys.argv', new=cli_cmd):
|
| |
cli = self.new_cli()
|
| |
cli.lint()
|
| |
|
| |
- rpmlint = ['rpmlint', '-i', os.path.join(cli.cmd.path, cli.cmd.spec)]
|
| |
- _run_command.assert_called_once_with(rpmlint, shell=True)
|
| |
+ _run_command.assert_has_calls([
|
| |
+ call(['rpmlint', '--version'], return_stdout=True, return_text=True),
|
| |
+ call(['rpmlint', '-i', os.path.join(cli.cmd.path, cli.cmd.spec)], shell=True),
|
| |
+ ])
|
| |
|
| |
@patch('pyrpkg.Commands._run_command')
|
| |
def test_lint_with_default_config_file(self, _run_command):
|
| |
@@ -1085,13 +1091,37 @@
|
| |
open(lint_config_path, 'a').close()
|
| |
|
| |
cli_cmd = ['rpkg', '--name', 'docpkg', '--path', self.cloned_repo_path, 'lint']
|
| |
+ _run_command.return_value = [0, "version 1.1", None]
|
| |
|
| |
with patch('sys.argv', new=cli_cmd):
|
| |
cli = self.new_cli()
|
| |
cli.lint()
|
| |
|
| |
- rpmlint = ['rpmlint', '-f', lint_config_path, os.path.join(cli.cmd.path, cli.cmd.spec)]
|
| |
- _run_command.assert_called_once_with(rpmlint, shell=True)
|
| |
+ _run_command.assert_has_calls([
|
| |
+ call(['rpmlint', '--version'], return_stdout=True, return_text=True),
|
| |
+ call(['rpmlint', '-f', lint_config_path, os.path.join(cli.cmd.path, cli.cmd.spec)],
|
| |
+ shell=True),
|
| |
+ ])
|
| |
+
|
| |
+ @patch('pyrpkg.Commands._run_command')
|
| |
+ def test_lint_with_default_config_file_newer_lint_package(self, _run_command):
|
| |
+ self.checkout_branch(git.Repo(self.cloned_repo_path), 'eng-rhel-7')
|
| |
+
|
| |
+ lint_config_path = os.path.join(self.cloned_repo_path, 'docpkg.rpmlintrc')
|
| |
+ open(lint_config_path, 'a').close()
|
| |
+
|
| |
+ cli_cmd = ['rpkg', '--name', 'docpkg', '--path', self.cloned_repo_path, 'lint']
|
| |
+ _run_command.return_value = [0, "version 2.0", None]
|
| |
+
|
| |
+ with patch('sys.argv', new=cli_cmd):
|
| |
+ cli = self.new_cli()
|
| |
+ cli.lint()
|
| |
+
|
| |
+ _run_command.assert_has_calls([
|
| |
+ call(['rpmlint', '--version'], return_stdout=True, return_text=True),
|
| |
+ call(['rpmlint', '-r', lint_config_path, os.path.join(cli.cmd.path, cli.cmd.spec)],
|
| |
+ shell=True),
|
| |
+ ])
|
| |
|
| |
@patch('pyrpkg.Commands._run_command')
|
| |
def test_lint_with_default_and_deprecated_config_files(self, _run_command):
|
| |
@@ -1103,13 +1133,17 @@
|
| |
open(deprecated_lint_config_path, 'a').close()
|
| |
|
| |
cli_cmd = ['rpkg', '--name', 'docpkg', '--path', self.cloned_repo_path, 'lint']
|
| |
+ _run_command.return_value = [0, "version 1.1", None]
|
| |
|
| |
with patch('sys.argv', new=cli_cmd):
|
| |
cli = self.new_cli()
|
| |
cli.lint()
|
| |
|
| |
- rpmlint = ['rpmlint', '-f', lint_config_path, os.path.join(cli.cmd.path, cli.cmd.spec)]
|
| |
- _run_command.assert_called_once_with(rpmlint, shell=True)
|
| |
+ _run_command.assert_has_calls([
|
| |
+ call(['rpmlint', '--version'], return_stdout=True, return_text=True),
|
| |
+ call(['rpmlint', '-f', lint_config_path, os.path.join(cli.cmd.path, cli.cmd.spec)],
|
| |
+ shell=True),
|
| |
+ ])
|
| |
|
| |
@patch('pyrpkg.Commands._run_command')
|
| |
def test_lint_with_custom_config_file(self, _run_command):
|
| |
@@ -1122,14 +1156,18 @@
|
| |
|
| |
cli_cmd = ['rpkg', '--name', 'docpkg', '--path', self.cloned_repo_path,
|
| |
'lint', '--rpmlintconf', 'custom.rpmlintrc']
|
| |
+ _run_command.return_value = [0, "version 1.1", None]
|
| |
|
| |
with patch('sys.argv', new=cli_cmd):
|
| |
cli = self.new_cli()
|
| |
cli.lint()
|
| |
|
| |
- rpmlint = ['rpmlint', '-f', custom_lint_config_path, os.path.join(cli.cmd.path,
|
| |
- cli.cmd.spec)]
|
| |
- _run_command.assert_called_once_with(rpmlint, shell=True)
|
| |
+ _run_command.assert_has_calls([
|
| |
+ call(['rpmlint', '--version'], return_stdout=True, return_text=True),
|
| |
+ call(['rpmlint', '-f', custom_lint_config_path,
|
| |
+ os.path.join(cli.cmd.path, cli.cmd.spec)],
|
| |
+ shell=True),
|
| |
+ ])
|
| |
|
| |
|
| |
class TestGitUrl(CliTestCase):
|
| |
'lint' subcommand internally executes 'rpmlint' binary. With 'rpmlint' package version 2.x it changed some of its input arguments. Rpkg has to recognize the installed 'rpmlint' version and use the corresponding switch/argument. Specifically, '-f' switch for user config file has changed to '-r' in the newer version.
Additionally, fixes some paths to source RPMs.
JIRA: RHELCMP-7842
Resolves: rhbz#1967821
Signed-off-by: Ondrej Nosek onosek@redhat.com