Created
July 8, 2012 04:39
-
-
Save yinyin/3069379 to your computer and use it in GitHub Desktop.
Modified unit2.py for automatic test discovery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# based on the unit2.py from unittest2 | |
# {{{ automatically attach options for discover | |
import sys | |
if (1 == len(sys.argv)) or ( (2 == len(sys.argv)) and (sys.argv[1] in ("-v", "--verbose",)) ): | |
extra_arg = None | |
if 2 == len(sys.argv): | |
extra_arg = sys.argv.pop() | |
sys.argv.extend(("discover", "-s", "test/", "-p", "test_*.py",)) | |
if extra_arg is not None: | |
sys.argv.append(extra_arg) | |
# }}} automatically attach options for discover | |
__unittest = True | |
from unittest2.main import main_ | |
main_() | |
# vim: ts=4 sw=4 ai nowrap |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment