[Libosinfo] [osinfo-db 1/2] tests: Add a XML validation test

Cole Robinson crobinso at redhat.com
Tue Mar 19 15:08:44 UTC 2019


On 3/18/19 5:28 PM, Fabiano Fidêncio wrote:
> test_validation replaces the `xmllint` call from our Makefile.
> 
> Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
> ---
>   Makefile                 | 11 +----------
>   tests/test_validation.py | 22 ++++++++++++++++++++++
>   tests/util.py            | 13 ++++++++++++-
>   3 files changed, 35 insertions(+), 11 deletions(-)
>   create mode 100644 tests/test_validation.py
> 
> diff --git a/Makefile b/Makefile
> index ca07fe3..f98993f 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -32,8 +32,6 @@ ARCHIVE = osinfo-db-$(TODAY).tar.xz
>   
>   ZANATA = zanata
>   
> -XMLLINT = xmllint
> -
>   PYTHON = python3
>   
>   V = 0
> @@ -122,13 +120,6 @@ update-po:
>             fi; \
>           done
>   
> -lint: $(DATA_FILES) $(SCHEMA_FILES)
> -	for xml in `find data -name '*.xml' | sort`; do \
> -	  if ! $(XMLLINT) --relaxng data/schema/osinfo.rng --noout $$xml; then \
> -	    exit 1; \
> -	  fi; \
> -	done
> -
>   unit-tests: $(DATA_FILES)
>   	@command -v $(PYTHON) > /dev/null; \
>   	if [ $$? -eq 0 ] ; then \
> @@ -140,4 +131,4 @@ unit-tests: $(DATA_FILES)
>   	  echo "unit-tests are not going to be executed as no $(PYTHON) has been found"; \
>   	fi
>   
> -check: lint unit-tests
> +check: unit-tests

Needs this squashed in for 'make check' to work from a clean checkout:

$ git diff
diff --git a/Makefile b/Makefile
index f98993f..0000306 100644
--- a/Makefile
+++ b/Makefile
@@ -120,7 +120,7 @@ update-po:
            fi; \
          done

-unit-tests: $(DATA_FILES)
+unit-tests: $(DATA_FILES) $(SCHEMA_FILES)
         @command -v $(PYTHON) > /dev/null; \
         if [ $$? -eq 0 ] ; then \
           for file in tests/test_*.py; do \

Otherwise for these two:

Reviewed-by: Cole Robinson <crobinso at redhat.com>

- Cole




More information about the Libosinfo mailing list