Make pytest-version mandatory

Fix #1118
This commit is contained in:
Bruno Oliveira 2015-10-17 13:37:01 -03:00
parent cf56f59f58
commit 75932a92d0
1 changed files with 15 additions and 14 deletions

View File

@ -13,11 +13,11 @@ Also includes plugin compatibility between different python and pytest versions,
obtained from http://plugincompat.herokuapp.com. obtained from http://plugincompat.herokuapp.com.
""" """
from __future__ import print_function from __future__ import print_function
from argparse import ArgumentParser
from collections import namedtuple from collections import namedtuple
import datetime import datetime
from distutils.version import LooseVersion from distutils.version import LooseVersion
import itertools import itertools
from optparse import OptionParser
import os import os
import sys import sys
import pytest import pytest
@ -103,7 +103,7 @@ def obtain_plugins_table(plugins, client, verbose, pytest_ver):
return pad_right % image_markup, target_markup return pad_right % image_markup, target_markup
else: else:
return ('`link <%s>`_' % target), '' return ('`link <%s>`_' % target), ''
def sanitize_summary(summary): def sanitize_summary(summary):
"""Make sure summaries don't break our table formatting. """Make sure summaries don't break our table formatting.
""" """
@ -268,20 +268,21 @@ def main(argv):
filename = os.path.join(os.path.dirname(__file__), 'index.rst') filename = os.path.join(os.path.dirname(__file__), 'index.rst')
url = 'http://pypi.python.org/pypi' url = 'http://pypi.python.org/pypi'
parser = OptionParser( parser = ArgumentParser(
description='Generates a restructured document of pytest plugins from PyPI') description='Generates a document with all pytest plugins from PyPI')
parser.add_option('-f', '--filename', default=filename, parser.add_argument('-f', '--filename', default=filename,
help='output filename [default: %default]') help='output filename [default: %default]')
parser.add_option('-u', '--url', default=url, parser.add_argument('-u', '--url', default=url,
help='url of PyPI server to obtain data from [default: %default]') help='url of PyPI server to obtain data from [default: %default]')
parser.add_option('-v', '--verbose', default=False, action='store_true', parser.add_argument('-v', '--verbose', default=False, action='store_true',
help='verbose output') help='verbose output')
parser.add_option('--pytest-ver', default=None, action='store', parser.add_argument('version', default=None, action='store',
help='generate index for this pytest version (default current version)') help='generate index for this pytest version')
(options, _) = parser.parse_args(argv[1:]) options = parser.parse_args()
client = get_proxy(options.url) client = get_proxy(options.url)
generate_plugins_index(client, options.filename, options.verbose, options.pytest_ver) generate_plugins_index(client, options.filename, options.verbose,
options.version)
print() print()
print('%s updated.' % options.filename) print('%s updated.' % options.filename)