Allow running a specific functional test via CLI

Change-Id: I5897d8121b7cc992d64f948f73f1f846615f6e46
This commit is contained in:
Dmitry Tantsur 2019-07-18 14:25:41 +02:00
parent 95caa2ec36
commit 4f578169c7
2 changed files with 9 additions and 3 deletions

View File

@ -18,6 +18,7 @@ import copy
import datetime import datetime
import json import json
import os import os
import sys
import tempfile import tempfile
import time import time
import unittest import unittest
@ -798,5 +799,10 @@ def mocked_server():
if __name__ == '__main__': if __name__ == '__main__':
if len(sys.argv) > 1:
test_name = sys.argv[1]
else:
test_name = None
with mocked_server(): with mocked_server():
unittest.main(verbosity=2) unittest.main(verbosity=2, defaultTest=test_name)

View File

@ -52,12 +52,12 @@ commands =
[testenv:functional] [testenv:functional]
basepython = python2.7 basepython = python2.7
commands = commands =
python -m ironic_inspector.test.functional python -m ironic_inspector.test.functional {posargs}
[testenv:functional-py36] [testenv:functional-py36]
basepython = python3 basepython = python3
commands = commands =
python3 -m ironic_inspector.test.functional python3 -m ironic_inspector.test.functional {posargs}
[testenv:genconfig] [testenv:genconfig]
basepython = python3 basepython = python3