Skip to content

Commit

Permalink
tests: Add --test-only param
Browse files Browse the repository at this point in the history
  • Loading branch information
sils committed Feb 3, 2015
1 parent 6d449c0 commit 43264e9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion execute_all_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,21 @@ def show_help():
epilog="Please note that the tests for coala are split into tests for the main "
"program and the bears. By default all these tests are executed, however "
"you can switch them off individually.")
parser.add_argument("-t", "--test-only", help="execute only the tests with the given base name", nargs="+")
parser.add_argument("-c", "--cover", help="measure code coverage", action="store_true")
parser.add_argument("-H", "--html", help="generate html code coverage, implies -c", action="store_true")
parser.add_argument("-b", "--ignore-bear-tests", help="ignore bear tests", action="store_true")
parser.add_argument("-m", "--ignore-main-tests", help="ignore main program tests", action="store_true")
parser.add_argument("-v", "--verbose", help="more verbose output", action="store_true")
parser.add_argument("-o", "--omit", help="base names of tests to omit", nargs="+")
parser.add_argument("-o", "--omit", help="base names of tests to omit, overwrites -t", nargs="+")
args = parser.parse_args()
args.cover = args.cover or args.html

omit = args.omit
test_only = args.test_only
if omit is not None and test_only is not None:
parser.error("Incompatible options.")

if omit is None:
omit = []

Expand All @@ -40,6 +45,13 @@ def show_help():
if not args.ignore_bear_tests:
files.extend(TestHelper.get_test_files(os.path.abspath("bears/tests"), omit))

if test_only is not None:
new_files = []
for file in files:
if os.path.splitext(os.path.basename(file))[0] in test_only:
new_files.append(file)
files = new_files

ignore_list = files[:]
ignore_list.extend([
os.path.join(tempfile.gettempdir(), "*"),
Expand Down

0 comments on commit 43264e9

Please sign in to comment.