示例#1
0
def check(args=None):
    """
    Checks for pep8 and other code styling conventions.
    """
    value = call("flake8 --max-line-length=150 --statistics openslides tests")
    value += call("python -m mypy openslides/ tests/")
    return value
示例#2
0
def check(args=None):
    """
    Checks for pep8 and other code styling conventions.
    """
    value = call("flake8 --max-line-length=150 --statistics openslides tests")
    value += call("python -m mypy openslides/ tests/")
    return value
示例#3
0
def coverage(args=None, plain=None):
    """
    Runs the tests and creates a coverage report.

    By default it creates a html report. With the argument --plain, it creates
    a plain report and fails under a certain amount of untested lines.
    """
    if plain is None:
        plain = getattr(args, 'plain', False)
    if plain:
        return call('coverage report -m --fail-under=80')
    else:
        return call('coverage html')
示例#4
0
def coverage(args=None, plain=None):
    """
    Runs the tests and creates a coverage report.

    By default it creates a html report. With the argument --plain, it creates
    a plain report and fails under a certain amount of untested lines.
    """
    if plain is None:
        plain = getattr(args, 'plain', False)
    if plain:
        return call('coverage report -m --fail-under=80')
    else:
        return call('coverage html')
示例#5
0
def travis(args=None):
    """
    Runs all commands that travis tests.
    """
    return_codes = []
    with open('.travis.yml') as f:
        script_lines = False
        for line in (line.strip() for line in f.readlines()):
            if line == 'script:':
                script_lines = True
                continue
            if not script_lines or not line:
                continue

            match = re.search(r'"(.*)"', line)
            print('Run: %s' % match.group(1))
            return_code = call(match.group(1))
            return_codes.append(return_code)
            if return_code:
                print(FAIL + 'fail!\n' + RESET)
            else:
                print(SUCCESS + 'success!\n' + RESET)

    # Retuns True if one command exited with a different statuscode then 1
    return bool(list(filter(bool, return_codes)))
示例#6
0
def test(args=None):
    """
    Runs the tests.
    """
    module = getattr(args, 'module', '')
    return call("DJANGO_SETTINGS_MODULE='tests.settings' coverage run "
                "./manage.py test tests.%s" % module)
示例#7
0
def travis(args=None):
    """
    Runs all commands that travis tests.
    """
    return_codes = []
    with open('.travis.yml') as f:
        script_lines = False
        for line in (line.strip() for line in f.readlines()):
            if line == 'script:':
                script_lines = True
                continue
            if not script_lines or not line:
                continue

            match = re.search(r'"(.*)"', line)
            print('Run: %s' % match.group(1))
            return_code = call(match.group(1))
            return_codes.append(return_code)
            if return_code:
                print(FAIL + 'fail!\n' + RESET)
            else:
                print(SUCCESS + 'success!\n' + RESET)

    # Retuns True if one command exited with a different statuscode then 1
    return bool(list(filter(bool, return_codes)))
示例#8
0
def test(args=None):
    """
    Runs the tests.
    """
    module = getattr(args, 'module', '')
    if module == '':
        module = 'tests'
    else:
        module = 'tests.{}'.format(module)
    return call("DJANGO_SETTINGS_MODULE='tests.settings' coverage run "
                "./manage.py test {}".format(module))
示例#9
0
def test(args=None):
    """
    Runs the tests.
    """
    module = getattr(args, 'module', '')
    if module == '':
        module = 'tests'
    else:
        module = 'tests.{}'.format(module)
    return call("DJANGO_SETTINGS_MODULE='tests.settings' coverage run "
                "./manage.py test {}".format(module))
示例#10
0
def clean(args=None):
    """
    Deletes all .pyc and .orig files and empty folders.
    """
    call('find -name "*.pyc" -delete')
    call('find -name "*.orig" -delete')
    call("find -type d -empty -delete")
示例#11
0
def clean(args=None):
    """
    Deletes all .pyc and .orig files and empty folders.
    """
    call('find -name "*.pyc" -delete')
    call('find -name "*.orig" -delete')
    call('find -type d -empty -delete')
示例#12
0
def travis(args=None):
    """
    Runs all commands that travis tests.
    """
    return_codes = []
    with open('.travis.yml') as f:
        travis = yaml.load(f)
        for line in travis['script']:
            print('Run: {}'.format(line))
            return_code = call(line)
            return_codes.append(return_code)
            if return_code:
                print(FAIL + 'fail!\n' + RESET)
            else:
                print(SUCCESS + 'success!\n' + RESET)

    # Retuns True if one command exited with a different statuscode then 1
    return bool(list(filter(bool, return_codes)))
示例#13
0
def travis(args=None):
    """
    Runs all commands that travis tests.
    """
    return_codes = []
    with open(".travis.yml") as f:
        travis = yaml.load(f)
        for line in travis["script"]:
            print(f"Run: {line}")
            return_code = call(line)
            return_codes.append(return_code)
            if return_code:
                print(FAIL + "fail!\n" + RESET)
            else:
                print(SUCCESS + "success!\n" + RESET)

    # Retuns True if one command exited with a different statuscode then 1
    return bool(list(filter(bool, return_codes)))
示例#14
0
def travis(args=None):
    """
    Runs all commands that travis tests.
    """
    return_codes = []
    with open(".travis.yml") as f:
        travis = yaml.load(f)
        for line in travis["script"]:
            print(f"Run: {line}")
            return_code = call(line)
            return_codes.append(return_code)
            if return_code:
                print(FAIL + "fail!\n" + RESET)
            else:
                print(SUCCESS + "success!\n" + RESET)

    # Retuns True if one command exited with a different statuscode then 1
    return bool(list(filter(bool, return_codes)))
示例#15
0
def travis(args=None):
    """
    Runs all commands that travis tests.
    """
    return_codes = []
    with open('.travis.yml') as f:
        script_lines = False
        for line in (line.strip() for line in f.readlines()):
            if line == 'script:':
                script_lines = True
                continue
            if not script_lines:
                continue

            match = re.search(r'"(.*)"', line)
            return_codes.append(call(match.group(1)))

    # Retuns True if one command exited with a different statuscode then 1
    return bool(list(filter(bool, return_codes)))
示例#16
0
def isort(args=None):
    return call('isort --recursive openslides tests')
示例#17
0
def isort(args=None):
    call("isort --recursive openslides tests")
    call("black --target-version py36 openslides tests")
示例#18
0
def isort(args=None):
    return call('isort --recursive openslides tests')
示例#19
0
def check(args=None):
    """
    Checks for pep8 and other code styling conventions.
    """
    return call('flake8 --max-line-length=150 --statistics openslides tests')
示例#20
0
def isort(args=None):
    call("isort --recursive openslides tests")
    call("black --py36 openslides tests")
示例#21
0
def check(args=None):
    """
    Checks for pep8 and other code styling conventions.
    """
    return call('flake8 --max-line-length=150 --statistics openslides tests')