[Libosinfo] [osinfo-db PATCH 0/4] RFC: Add basic tests for osinfo-db

Cole Robinson crobinso at redhat.com
Fri Mar 15 21:06:32 UTC 2019


On 3/13/19 4:44 PM, Fabiano Fidêncio wrote:
> This series introduces 3 basic tests for osinfo-db that currently are
> part of libosinfo.
> 
> The tests chosen for this initial work are the test-*.uris. The
> short-term plan is to move test-isodetect here as well, removing them
> the need of updating libosinfo tests for each new entry added to
> osinfo-db.
> 
> As osinfo-db doesn't rely on autotools, some hacks have been in the
> Makefile in order to keep one log file per test.
> 
> Fabiano Fidêncio (4):
>   Makefile: Split xmllint from check
>   tests: Add media tests
>   tests: Add tree tests
>   tests: Add image tests
> 

Looks like as good of a place to start as any. The tests work fine for
me. There's some pylint issues that should be fixed but they aren't
causing any functional problems that I can tell[1].

Why put code in tests/unit/ and not just tests/ ?

I think we can have a single file and test case for checking all URLs
exist, rather than 3 files, it can be the single entry point we extend
to test more URLs, like driver location= is a candidate (for a later series)

After this series is in, short term test prios IMO:

- Turn the xmllint test into a python test using libxml2 APIs. We did
this in libvirt with tests/virschematest.c, it's much faster and will
give native test output.

- Maybe silence the test output when we are skipping network tests, so
the default invocation doesn't spam a bunch of skip markers. Also if we
convert the XML validation to a test we probably don't want it printing
100s of dots, it's really not that useful feedback for lots of super
quick actions. Pytest has a bunch of output options though so we can
play with it and figure out something optimal

But I'd prefer to do those as follow up patches

- Cole

[1]
************* Module unit.test_tree
unit/test_tree.py:11:14: W0621: Redefining name 'os' from outer scope
(line 3) (redefined-outer-name)
unit/test_tree.py:11:4: E0213: Method should have "self" as first
argument (no-self-argument)
unit/test_tree.py:12:15: E1101: Instance of 'TestTree' has no 'shortid'
member (no-member)
unit/test_tree.py:17:28: W0621: Redefining name 'os' from outer scope
(line 3) (redefined-outer-name)
************* Module unit.test_image
unit/test_image.py:11:14: W0621: Redefining name 'os' from outer scope
(line 3) (redefined-outer-name)
unit/test_image.py:11:4: E0213: Method should have "self" as first
argument (no-self-argument)
unit/test_image.py:12:15: E1101: Instance of 'TestImage' has no
'shortid' member (no-member)
unit/test_image.py:17:29: W0621: Redefining name 'os' from outer scope
(line 3) (redefined-outer-name)
************* Module unit.osinfo
unit/osinfo.py:77:8: W1201: Specify string format arguments as logging
function parameters (logging-not-lazy)
unit/osinfo.py:79:8: W1201: Specify string format arguments as logging
function parameters (logging-not-lazy)
unit/osinfo.py:5:0: C0411: standard import "from http.client import
responses" should be placed before "import requests" (wrong-import-order)
************* Module unit.util
unit/util.py:28:4: W0621: Redefining name 'os' from outer scope (line 4)
(redefined-outer-name)
unit/util.py:32:4: W0621: Redefining name 'oses' from outer scope (line
31) (redefined-outer-name)
unit/util.py:5:0: W0611: Unused import sys (unused-import)
************* Module unit.test_media
unit/test_media.py:11:14: W0621: Redefining name 'os' from outer scope
(line 3) (redefined-outer-name)
unit/test_media.py:11:4: E0213: Method should have "self" as first
argument (no-self-argument)
unit/test_media.py:12:15: E1101: Instance of 'TestMedia' has no
'shortid' member (no-member)
unit/test_media.py:17:29: W0621: Redefining name 'os' from outer scope
(line 3) (redefined-outer-name)




More information about the Libosinfo mailing list