Add version option for ostestr and subunit-trace
This commit adds a version option to os-testr commands. Users would like to confirm the version when then face unexpected behavior of the command like a bug. Change-Id: I30ee9623c25f2ce2da0fab0b5e0a2795b46a2cd6
This commit is contained in:
parent
9a6f4c9653
commit
0bb53cdfcc
@ -17,11 +17,19 @@
|
||||
import datetime
|
||||
import sys
|
||||
|
||||
import pbr.version
|
||||
import subunit
|
||||
from subunit import iso8601
|
||||
|
||||
|
||||
__version__ = pbr.version.VersionInfo('os_testr').version_string()
|
||||
|
||||
|
||||
def main():
|
||||
if '--version' in sys.argv:
|
||||
print(__version__)
|
||||
exit(0)
|
||||
|
||||
start_time = datetime.datetime.fromtimestamp(float(sys.argv[1])).replace(
|
||||
tzinfo=iso8601.UTC)
|
||||
elapsed_time = datetime.timedelta(seconds=int(sys.argv[2]))
|
||||
|
@ -19,13 +19,19 @@ import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import pbr.version
|
||||
from subunit import run as subunit_run
|
||||
from testtools import run as testtools_run
|
||||
|
||||
|
||||
__version__ = pbr.version.VersionInfo('os_testr').version_string()
|
||||
|
||||
|
||||
def get_parser(args):
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Tool to run openstack tests')
|
||||
parser.add_argument('--version', action='version',
|
||||
version='%s' % __version__)
|
||||
list_files = parser.add_mutually_exclusive_group()
|
||||
list_files.add_argument('--blacklist_file', '-b',
|
||||
help='Path to a blacklist file, this file '
|
||||
|
@ -60,10 +60,12 @@ import sys
|
||||
import traceback
|
||||
from xml.sax import saxutils
|
||||
|
||||
import pbr.version
|
||||
import subunit
|
||||
import testtools
|
||||
|
||||
__version__ = '0.1'
|
||||
|
||||
__version__ = pbr.version.VersionInfo('os_testr').version_string()
|
||||
|
||||
|
||||
class TemplateData(object):
|
||||
@ -701,6 +703,10 @@ class FileAccumulator(testtools.StreamResult):
|
||||
|
||||
|
||||
def main():
|
||||
if '--version' in sys.argv:
|
||||
print(__version__)
|
||||
exit(0)
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print("Need at least one argument: path to subunit log.")
|
||||
exit(1)
|
||||
|
@ -26,6 +26,7 @@ import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
import pbr.version
|
||||
import subunit
|
||||
import testtools
|
||||
|
||||
@ -313,8 +314,13 @@ def print_summary(stream, elapsed_time):
|
||||
stream.write(out_str)
|
||||
|
||||
|
||||
__version__ = pbr.version.VersionInfo('os_testr').version_string()
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--version', action='version',
|
||||
version='%s' % __version__)
|
||||
parser.add_argument('--no-failure-debug', '-n', action='store_true',
|
||||
dest='print_failures', help='Disable printing failure '
|
||||
'debug information in realtime')
|
||||
|
Loading…
Reference in New Issue
Block a user