From 9926791bf0285353ec08538a47e6007a97e024cf Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Mon, 17 Apr 2023 15:31:46 +0200 Subject: [PATCH] Fix 'buildhistory' command by setting the type of the '--limit' option to int --- behave/features/buildhist.feature | 5 +++++ osc/_private/api_build.py | 2 +- osc/commandline.py | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/behave/features/buildhist.feature b/behave/features/buildhist.feature index 480f2f28..b7b793a3 100644 --- a/behave/features/buildhist.feature +++ b/behave/features/buildhist.feature @@ -11,6 +11,11 @@ Scenario: Run `osc buildist / /` Then the exit code is 0 +Scenario: Run `osc buildist / / --limit` + When I execute osc with args "buildhist test:factory/test-pkgA standard/x86_64 --limit=1" + Then the exit code is 0 + + Scenario: Run `osc buildist /` from a package checkout Given I execute osc with args "co test:factory/test-pkgA" And I set working directory to "{context.osc.temp}/test:factory/test-pkgA" diff --git a/osc/_private/api_build.py b/osc/_private/api_build.py index 2b89fe28..3e61dc1c 100644 --- a/osc/_private/api_build.py +++ b/osc/_private/api_build.py @@ -20,7 +20,7 @@ class BuildHistory: self.package = package self.repository = repository self.arch = arch - self._limit = limit + self._limit = int(limit) self.entries = self._get_entries() def _get_entries(self): diff --git a/osc/commandline.py b/osc/commandline.py index 1b8eaabd..cb67da9e 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -7381,7 +7381,7 @@ Please submit there instead, or use --nodevelproject to force direct submission. @cmdln.option('', '--csv', action='store_true', help='generate output in CSV (separated by |)') - @cmdln.option('-l', '--limit', metavar='limit', + @cmdln.option('-l', '--limit', metavar='limit', type=int, default=0, help='for setting the number of results') @cmdln.option('-M', '--multibuild-package', metavar='FLAVOR', help=HELP_MULTIBUILD_ONE)