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

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



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
 
 check: unit-tests
-- 
2.21.0


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