[PATCH osinfo-db 2/3] tests: conftest: handle default log-level setting

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

 



This makes log-level=info the default for direct pytest-3 invocations,
and lets us drop the fallback detection in Makefile

Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx>
---
 Makefile          | 4 +---
 tests/conftest.py | 5 +++++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 9d7f109..b3e06d5 100644
--- a/Makefile
+++ b/Makefile
@@ -34,8 +34,6 @@ ZANATA = zanata
 
 PYTHON = python3
 
-PYTEST_LOG_LEVEL = $(shell $(PYTHON) -m pytest --help | grep log-level >/dev/null && echo "--log-level=info")
-
 V = 0
 
 V_I18N = $(V_I18N_$(V))
@@ -123,4 +121,4 @@ update-po:
         done
 
 check: $(DATA_FILES) $(SCHEMA_FILES)
-	LC_ALL= LANG=C LC_CTYPE=en_US.UTF-8 $(PYTHON) -m pytest $(PYTEST_LOG_LEVEL)
+	LC_ALL= LANG=C LC_CTYPE=en_US.UTF-8 $(PYTHON) -m pytest
diff --git a/tests/conftest.py b/tests/conftest.py
index 67b3a6f..4a16a04 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -16,6 +16,11 @@ def pytest_configure(config):
         os.environ[key] = os.path.realpath(os.path.join(
             os.path.dirname(__file__), "..", "data"))
 
+    # Default to --log-level=info if not otherwise specified
+    if (hasattr(config.option, "log_level") and
+        config.option.log_level is None):
+        config.option.log_level = "info"
+
     # This will trigger some DATA_DIR validation
     from . import util
     dummy = util
-- 
2.21.0

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux