From 4f578169c7bb389c6ad930a90cf810487f0a10ea Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Thu, 18 Jul 2019 14:25:41 +0200 Subject: [PATCH] Allow running a specific functional test via CLI Change-Id: I5897d8121b7cc992d64f948f73f1f846615f6e46 --- ironic_inspector/test/functional.py | 8 +++++++- tox.ini | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ironic_inspector/test/functional.py b/ironic_inspector/test/functional.py index bd8f49e0e..ca18f592e 100644 --- a/ironic_inspector/test/functional.py +++ b/ironic_inspector/test/functional.py @@ -18,6 +18,7 @@ import copy import datetime import json import os +import sys import tempfile import time import unittest @@ -798,5 +799,10 @@ def mocked_server(): if __name__ == '__main__': + if len(sys.argv) > 1: + test_name = sys.argv[1] + else: + test_name = None + with mocked_server(): - unittest.main(verbosity=2) + unittest.main(verbosity=2, defaultTest=test_name) diff --git a/tox.ini b/tox.ini index 6c783b3d2..6e77f90de 100644 --- a/tox.ini +++ b/tox.ini @@ -52,12 +52,12 @@ commands = [testenv:functional] basepython = python2.7 commands = - python -m ironic_inspector.test.functional + python -m ironic_inspector.test.functional {posargs} [testenv:functional-py36] basepython = python3 commands = - python3 -m ironic_inspector.test.functional + python3 -m ironic_inspector.test.functional {posargs} [testenv:genconfig] basepython = python3