Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time
# This file is part of Gruvi. Gruvi is free software available under the
# terms of the MIT license. See the file "LICENSE" that was provided
# together with this source file for the licensing terms.
# Copyright (c) 2012-2014 the Gruvi authors. See the file "AUTHORS" for a
# complete list.
from __future__ import absolute_import, print_function
import os
import sys
from argparse import ArgumentParser
from unittest import TestLoader, TextTestRunner, TestSuite
parser = ArgumentParser()
parser.add_argument('-v', '--verbose', help='be more verbose', action='count', default=1)
parser.add_argument('-f', '--failfast', help='stop on first failure', action='store_true')
parser.add_argument('-b', '--buffer', help='buffer stdout and stderr', action='store_true')
parser.add_argument('suite', nargs='+', help='name of test suite to run', metavar='suite',
choices=('all', 'unit', 'performance', 'memory', 'examples'))
args = parser.parse_args()
if 'all' in args.suite:
args.suite = ['unit', 'performance', 'memory', 'examples']
# $VERBOSE can override -v
verbose = int(os.environ['VERBOSE'])
except (KeyError, ValueError):
verbose = args.verbose
os.environ['VERBOSE'] = str(verbose)
# Change directory to tests/ irrespective of where we're called from.
topdir = os.path.split(os.path.abspath(__file__))[0]
testdir = os.path.join(topdir, 'tests')
sys.path.insert(0, testdir)
from support import TestCase, MemoryTest, PerformanceTest
suite = TestSuite()
for name in args.suite:
if name == 'unit':
pattern = 'test_*.py'
elif name == 'performance':
pattern = 'perf_*.py'
elif name == 'memory':
pattern = ''
elif name == 'examples':
pattern = ''
loader = TestLoader()
tests ='.', pattern)
runner = TextTestRunner(verbosity=verbose, buffer=args.buffer, failfast=args.failfast)
result =
if result.errors or result.failures: