[Rpm-ecosystem] Testing suggestions for "dnf --quiet repolist" & dnf --quiet list"?
Nick Coghlan
ncoghlan at gmail.com
Tue Jul 14 05:08:41 UTC 2015
As a way to get started on dnf development, I'm taking a look at
https://bugzilla.redhat.com/show_bug.cgi?id=1236310
This bug points out that "dnf --quiet list" produces output, while
"dnf --quiet repolist" does not.
The actual bug is fairly straightforward: "dnf repolist" is currently
using "logger.info" for command output, when it should be using
"print" (as per
https://docs.python.org/3/howto/logging.html#when-to-use-logging)
The part I'm not clear on is how best to structure the tests for this,
as they're really integration tests that check for unintended coupling
between the logging configuration and the expected output of different
commands. At the moment, there are separate unit tests for the
individual commands, the option parsing, and the logging
configuration, but I didn't spot any functional tests covering the
interaction between them.
Assuming I haven't missed an existing home for such tests, would it
perhaps be worth my while investing time in setting up some separate
higher level behavioural tests that test the CLI itself as a black
box, rather than testing the Python API?
Specifically, I'm thinking that behave scenarios could be a good way
of testing some end-to-end user facing CLI behaviour for "given this
command line, we expect this command output":
http://pythonhosted.org/behave/tutorial.html#scenario-outlines
We wouldn't want to go overboard with these, but I think they'd be a
good way to check the basic interconnections between components are in
place.
Regards,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
More information about the Rpm-ecosystem
mailing list