[Libosinfo] [PATCH osinfo-db] tests: Simplify 'make check'

Fabiano Fidêncio fidencio at redhat.com
Fri Mar 22 07:26:41 UTC 2019


Cole,

On Thu, Mar 21, 2019 at 7:51 PM Cole Robinson <crobinso at redhat.com> wrote:
>
> Strip out everything except: python3 -m pytest --log-level=info
>
> * Per test log files are dropped entirely. This was just capturing
>   the same test output we get from stdout and saving it. IMO just
>   depending on stdout is good enough
> * pytest  will scoop up all the test files and run them in one batch.
> * 'make' will print the command before running, so any users will see
>   how to invoke the tests manually if they want to add pytest options.
> * Missing python3 or pytest module will generate an error, no need to
>   report a custom message to the user
>
> Signed-off-by: Cole Robinson <crobinso at redhat.com>
> ---
> This can go in before my --network-tests patch
>
>  .gitignore |  1 -
>  Makefile   | 10 +---------
>  2 files changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/.gitignore b/.gitignore
> index 938a7b9..b3213af 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -7,7 +7,6 @@ data/*/*/*.xml
>  data/*/*/*/*.xml
>  data/schema/osinfo.rng
>  tests/__pycache__
> -tests/*.log
>  .pytest_cache
>  *~
>  #*
> diff --git a/Makefile b/Makefile
> index d66ff2a..0f0db11 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -121,14 +121,6 @@ update-po:
>          done
>
>  unit-tests: $(DATA_FILES) $(SCHEMA_FILES)
> -       @command -v $(PYTHON) > /dev/null; \
> -       if [ $$? -eq 0 ] ; then \
> -         for file in tests/test_*.py; do \
> -           log_file=`echo $$file | $(SED) -e 's/\.py/.log/'`; \
> -           $(PYTHON) -m pytest -s $$file --log-level=info | $(TEE) $$log_file; \
> -         done; \
> -       else \
> -         echo "unit-tests are not going to be executed as no $(PYTHON) has been found"; \
> -       fi
> +       $(PYTHON) -m pytest --log-level=info

I'll go a little bit further here. We could just remove the unit-tests
target and leave the $(PYTHON) -m pytest --log-level=info and the
check target.

>
>  check: unit-tests
> --
> 2.21.0
>
> _______________________________________________
> Libosinfo mailing list
> Libosinfo at redhat.com
> https://www.redhat.com/mailman/listinfo/libosinfo

Best Regards,
--
Fabiano Fidêncio




More information about the Libosinfo mailing list