Mercurial > hg > htest
changeset 1:f3e18bcfb90b default tip
more stubbing
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Fri, 09 Sep 2016 16:20:35 -0700 |
parents | 26f27678ae32 |
children | |
files | htest/httptest.py |
diffstat | 1 files changed, 3 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/htest/httptest.py Fri Sep 09 16:15:58 2016 -0700 +++ b/htest/httptest.py Fri Sep 09 16:20:35 2016 -0700 @@ -2,32 +2,15 @@ # -*- coding: utf-8 -*- """ - +test HTTP connectivity """ # imports import argparse import os -import subprocess import sys import time -# python requirements -# (key, value) = (module, PyPI name) -requirements = () -for module, package in requirements: - try: - globals()[module] = __import__(module) - except ImportError: - # install requirement and try again - subprocess.check_call(['pip', 'install', package]) - args = [sys.executable] + sys.argv - os.execl(sys.executable, *args) - -# module globals -__all__ = ['main', 'Parser'] -here = os.path.dirname(os.path.realpath(__file__)) -string = (str, unicode) def ensure_dir(directory): """ensure a directory exists""" @@ -39,8 +22,9 @@ return directory -class Parser(argparse.ArgumentParser): +class HTTPTestParser(argparse.ArgumentParser): """CLI option parser""" + def __init__(self, **kwargs): kwargs.setdefault('formatter_class', argparse.RawTextHelpFormatter) kwargs.setdefault('description', __doc__)