]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
test/py: expose config and log as session scoped fixture
authorStefan Brüns <stefan.bruens@rwth-aachen.de>
Sat, 5 Nov 2016 16:45:32 +0000 (17:45 +0100)
committerTom Rini <trini@konsulko.com>
Mon, 21 Nov 2016 19:07:27 +0000 (14:07 -0500)
If a test uses a fixture which is expensive to setup, the fixture can
possibly created with session or module scope. As u_boot_console has
function scope, it can not be used in this case.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
test/py/conftest.py

index 1f15e3e33dcf7e7c0dc6a9ceaaf3dd8d06ae6cd0..65e1d75626cf82105b11130458ac9b264e0ffaa1 100644 (file)
@@ -298,6 +298,32 @@ def pytest_generate_tests(metafunc):
             continue
         generate_config(metafunc, fn)
 
+@pytest.fixture(scope='session')
+def u_boot_log(request):
+     """Generate the value of a test's log fixture.
+
+     Args:
+         request: The pytest request.
+
+     Returns:
+         The fixture value.
+     """
+
+     return console.log
+
+@pytest.fixture(scope='session')
+def u_boot_config(request):
+     """Generate the value of a test's u_boot_config fixture.
+
+     Args:
+         request: The pytest request.
+
+     Returns:
+         The fixture value.
+     """
+
+     return console.config
+
 @pytest.fixture(scope='function')
 def u_boot_console(request):
     """Generate the value of a test's u_boot_console fixture.