| |
@@ -886,6 +886,60 @@
|
| |
rpmlint = ['rpmlint', '-i', os.path.join(cli.cmd.path, cli.cmd.spec)]
|
| |
_run_command.assert_called_once_with(rpmlint, shell=True)
|
| |
|
| |
+ @patch('pyrpkg.Commands._run_command')
|
| |
+ def test_lint_with_default_config_file(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', '--module-name', 'docpkg', '--path', self.cloned_repo_path, 'lint']
|
| |
+
|
| |
+ 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)
|
| |
+
|
| |
+ @patch('pyrpkg.Commands._run_command')
|
| |
+ def test_lint_with_default_and_deprecated_config_files(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()
|
| |
+ deprecated_lint_config_path = os.path.join(self.cloned_repo_path, '.rpmlint')
|
| |
+ open(deprecated_lint_config_path, 'a').close()
|
| |
+
|
| |
+ cli_cmd = ['rpkg', '--module-name', 'docpkg', '--path', self.cloned_repo_path, 'lint']
|
| |
+
|
| |
+ 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)
|
| |
+
|
| |
+ @patch('pyrpkg.Commands._run_command')
|
| |
+ def test_lint_with_custom_config_file(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()
|
| |
+ custom_lint_config_path = os.path.join(self.cloned_repo_path, 'custom.rpmlint')
|
| |
+ open(custom_lint_config_path, 'a').close()
|
| |
+
|
| |
+ cli_cmd = ['rpkg', '--module-name', 'docpkg', '--path', self.cloned_repo_path,
|
| |
+ 'lint', '--rpmlintconf', 'custom.rpmlint']
|
| |
+
|
| |
+ 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)
|
| |
+
|
| |
|
| |
class TestGitUrl(CliTestCase):
|
| |
|
| |
Current rpmlint configuration file (.rpmlint) is hidden. Making the file
visible may encourage packagers looking at other repositories to
properly configure rpmlint runs and omit false positives. This commit
makes <module_name>.rpmlintrc the default configuration file and
triggers a deprecation message whenever a .rpmlint file is implicitly
used.
Signed-off-by: Athos Ribeiro athoscr@fedoraproject.org