Ejemplo n.º 1
0
def publish():
    """
    Upload the generated files to gh-pages branch.
    """
    print("Publishing changes to GitHub gh-pages branch...")
    ghp_import = pave.fs.join([pave.path.build, "bin", "ghp-import"])
    pave.execute(command=[ghp_import, "-p", "-r", "origin", "-b", "gh-pages", "deploy"], output=sys.stdout)
Ejemplo n.º 2
0
def publish():
    """
    Upload the generated files to gh-pages branch.
    """
    print('Publishing changes to GitHub gh-pages branch...')
    ghp_import = pave.fs.join([pave.path.build, 'bin', 'ghp-import'])
    pave.execute(
        command=[ghp_import, '-p', '-r', 'origin', '-b', 'gh-pages', 'deploy'],
        output=sys.stdout,
        )
Ejemplo n.º 3
0
def test_py3():
    """
    Run checks for py3 compatibility.
    """
    from pylint.lint import Run
    from nose.core import main as nose_main
    arguments = ['--py3k', SETUP['folders']['source']]
    linter = Run(arguments, exit=False)
    stats = linter.linter.stats
    errors = (
        stats['info'] + stats['error'] + stats['refactor'] +
        stats['fatal'] + stats['convention'] + stats['warning']
        )
    if errors:
        print 'Pylint failed'
        sys.exit(1)

    print 'Compiling in Py3 ...',
    command = ['python3', '-m', 'compileall', '-q', 'chevah']
    pave.execute(command, output=sys.stdout)
    print 'done'

    sys.argv = sys.argv[:1]
    pave.python_command_normal.extend(['-3'])

    warnings.filterwarnings('always', module='chevah.empirical')
    captured_warnings = []

    def capture_warning(
        message, category, filename,
        lineno=None, file=None, line=None
            ):
        if not filename.startswith('chevah'):
            # Not our code.
            return
        line = (message.message, filename, lineno)
        if line in captured_warnings:
            # Don't include duplicate warnings.
            return
        captured_warnings.append(line)

    warnings.showwarning = capture_warning

    sys.args = ['nose', 'chevah.empirical.tests.normal']
    runner = nose_main(exit=False)
    if not runner.success:
        print 'Test failed'
        sys.exit(1)
    if not captured_warnings:
        sys.exit(0)

    print '\nCaptured warnings\n'
    for warning, filename, line in captured_warnings:
        print '%s:%s %s' % (filename, line, warning)
    sys.exit(1)