[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



Cole,

On Thu, Mar 21, 2019 at 7:51 PM Cole Robinson <crobinso 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 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 redhat com
> https://www.redhat.com/mailman/listinfo/libosinfo

Best Regards,
--
Fabiano Fidêncio


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]