On Thu, Jun 27, 2019 at 01:08:38PM -0600, Tom Hromatka
<[email protected]> wrote:
> Example test invocations:
> [...]
Maybe these examples could be in the file tree itself (either one of the
Python files or README-like file).
> diff --git a/tests/ftests/ftests.py b/tests/ftests/ftests.py
> + args = parser.parse_args()
> +
> + config = Config()
> +
> + if args.name:
> + config.name = args.name
> + if args.config:
> + config.container.cfg_path = args.config
> + if args.distro:
> + config.container.distro = args.distro
> + if args.release:
> + config.container.release = args.release
> + if args.arch:
> + config.container.arch = args.arch
> + if args.timeout:
> + config.container.stop_timeout = args.timeout
> + if args.loglevel:
> + log.log_level = args.loglevel
> + if args.logfile:
> + log.log_file = args.logfile
> + if args.num:
> + config.test_num = args.num
> + if args.suite:
> + config.test_suite = args.suite
> + if args.unpriv:
> + raise ValueError('Unprivileged containers are not currently
> supported')
> + config.container.privileged = False
> + config.verbose = args.verbose
Is the Config class worth all this copying? What about using parsed args
directly (with the defaults).
> + if passed_cnt == 1:
> + test_str = "1 test"
> + print('\t%s%s' % ('{0: <30}'.format("Passed:"), '{0:
> >15}'.format(test_str)))
> + else:
> + test_str = "%d tests" % passed_cnt
> + print('\t%s%s' % ('{0: <30}'.format("Passed:"), '{0:
> >15}'.format(test_str)))
This duplication is prone to typos and hard to maintain. What about
"test%s".format("" if cnt == 1 else "s")
?
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel