Beispiel #1
0
def campaign(args):
    if args.version:
        print(bombard.__name__, bombard.version())
        with open(
                os.path.join(os.path.dirname(bombard.__file__), 'LICENSE.txt'),
                'r') as license:
            print(license.readline())
        return

    if args.quiet:
        level = logging.WARNING
    elif args.verbose:
        level = logging.DEBUG
    else:
        level = logging.INFO

    setup_logging(level=level, log_file_name=args.log)

    if args.init:
        init(args)
        return

    campaign_file_name = get_campaign_file_name(args)
    if os.path.isdir(campaign_file_name):
        show_folder(campaign_file_name)
    elif not (os.path.isfile(campaign_file_name) or args.init):
        print(red(f'\nCannot find campaign file "{args.file_name}"\n'))
    else:
        start_campaign(args, yaml.load(open(campaign_file_name, 'r')))
Beispiel #2
0
    def testVersion(self):
        with CaptureOutput() as captured:
            campaign(FakeArgs(version=True))

        with open(f'bombard/LICENSE.txt') as license:
            self.assertIn(license.readline(), captured.output)
        self.assertIn(bombard.version(), captured.output)
Beispiel #3
0
    def testVersion(self) -> None:
        with CaptureOutput() as captured:
            campaign(FakeArgs(version=True))

        with open("bombard/LICENSE.txt", encoding="utf8") as license:
            self.assertIn(license.readline(), captured.output)
        self.assertIn(bombard.version(), captured.output)
Beispiel #4
0
import setuptools

with open("README.rst", "r") as fh:
    long_description = fh.read()

with open('requirements.txt') as f:
    requirements = f.read().splitlines()

import sys
sys.path.insert(0, '../')
import bombard

setuptools.setup(
    name='bombard',
    version=bombard.version(),
    # scripts=['bin/bombard'],
    entry_points={
        'console_scripts': [
            'bombard=bombard.main:main',
        ],
    },
    author="Andrey Sorokin",
    author_email="*****@*****.**",
    description="Bombards target server with simultaneous requests",
    long_description=long_description,
    long_description_content_type="text/x-rst",
    url="https://bombard.readthedocs.io/en/latest/",
    packages=setuptools.find_packages(),
    include_package_data=True,
    install_requires=requirements,
    keywords='http load test parallel',
Beispiel #5
0
import bombard.version


__version__ = bombard.version.VERSION


def version():
    """ 'major.minor' without build number """
    return '.'.join(__version__.split('.')[:2])


if __name__ == '__main__':
    print(version())