From c1a891052b5be2765e0ebb084f6aa11c5255d0bb Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Thu, 27 Aug 2015 17:06:41 +0100 Subject: [PATCH] Put the pre-test code in a pytest fixture Signed-off-by: Bryan Boreham --- tests/integration_test.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/integration_test.py b/tests/integration_test.py index 6ba9c19c10..9424043a93 100644 --- a/tests/integration_test.py +++ b/tests/integration_test.py @@ -27,6 +27,7 @@ import unittest import warnings +import pytest import docker import six @@ -1578,10 +1579,11 @@ def test_649(self): self.client.stop(ctnr) -if __name__ == '__main__': +@pytest.fixture(scope="session", autouse=True) +def execute_before_any_test(): c = docker.Client(base_url=DEFAULT_BASE_URL) c.pull('busybox') exec_driver = c.info()['ExecutionDriver'] + global EXEC_DRIVER_IS_NATIVE EXEC_DRIVER_IS_NATIVE = exec_driver.startswith('native') c.close() - unittest.main()