예제 #1
0
def helper_run_with_fixture(kwargs=None):
    """ run tool with `output` as value for --output """
    
    if kwargs == None:
        kwargs = {}

    # set output default value
    if (not '--output' in kwargs) or (kwargs['--output'] == None):
        kwargs['--output'] = '_test_wtstats.html'

    # path replacement
    kwargs['--output'] = os.path.join(test_dir, kwargs['--output'])

    statsfile = os.path.join(test_dir, kwargs['files'] if 'files' in kwargs else 'WiredTigerStat.fixture')
    print "ST", statsfile

    arglist = ['./wtstats', statsfile]
    for item in kwargs.items():
        arglist.append(item[0]) 
        if item[1]: 
            arglist.append(item[1])

    sys.argv = arglist
    try:
        main()
    except SystemExit:
        pass
예제 #2
0
def helper_run_with_fixture(kwargs=None):
    """ run tool with `output` as value for --output """

    if kwargs == None:
        kwargs = {}

    # set output default value
    if (not '--output' in kwargs) or (kwargs['--output'] == None):
        kwargs['--output'] = '_test_wtstats.html'

    # path replacement
    kwargs['--output'] = os.path.join(test_dir, kwargs['--output'])

    statsfile = os.path.join(
        test_dir,
        kwargs['files'] if 'files' in kwargs else 'WiredTigerStat.fixture')
    print "ST", statsfile

    arglist = ['./wtstats', statsfile]
    for item in kwargs.items():
        arglist.append(item[0])
        if item[1]:
            arglist.append(item[1])

    sys.argv = arglist
    try:
        main()
    except SystemExit:
        pass
예제 #3
0
def test_output_default():
    """ wtstats should choose default output if not specified """

    statsfile = os.path.join(test_dir, 'WiredTigerStat.fixture')
    
    sys.argv = ['./wtstats', statsfile]
    try:
        main()
    except SystemExit:
        pass

    assert os.path.exists(os.path.join('./wtstats.html'))
    helper_delete_file('./wtstats.html')
예제 #4
0
def test_create_html_file_basic():
    """ wtstats should create an html file from the fixture stats """

    outfile = os.path.join(test_dir, 'wtstats_test.html')
    statsfile = os.path.join(test_dir, 'WiredTigerStat.fixture')
    
    sys.argv = ['./wtstats', statsfile, '--output', outfile]
    try:
        main()
    except SystemExit:
        pass

    assert os.path.exists(outfile)
예제 #5
0
def test_output_default():
    """ wtstats should choose default output if not specified """

    statsfile = os.path.join(test_dir, 'WiredTigerStat.fixture')

    sys.argv = ['./wtstats', statsfile]
    try:
        main()
    except SystemExit:
        pass

    assert os.path.exists(os.path.join('./wtstats.html'))
    helper_delete_file('./wtstats.html')
예제 #6
0
def test_create_html_file_basic():
    """ wtstats should create an html file from the fixture stats """

    outfile = os.path.join(test_dir, 'wtstats_test.html')
    statsfile = os.path.join(test_dir, 'WiredTigerStat.fixture')

    sys.argv = ['./wtstats', statsfile, '--output', outfile]
    try:
        main()
    except SystemExit:
        pass

    assert os.path.exists(outfile)
예제 #7
0
def test_help_working():
    """ wtstast should output the help screen when using --help argument """
    sys.argv = ['./wtstats.py', '--help']
    try:
        main()
    except SystemExit:
        pass

    # capture stdout
    output = sys.stdout.getvalue()

    assert output.startswith('usage:')
    assert 'positional arguments' in output
    assert 'optional arguments' in output
    assert 'show this help message and exit' in output
예제 #8
0
def test_help_working():
    """ wtstast should output the help screen when using --help argument """
    sys.argv = ['./wtstats.py', '--help']
    try:
        main()
    except SystemExit:
        pass

    # capture stdout
    output = sys.stdout.getvalue()

    assert output.startswith('usage:')
    assert 'positional arguments' in output
    assert 'optional arguments' in output
    assert 'show this help message and exit' in output