예제 #1
0
파일: flake8.py 프로젝트: zygyz/spack
def test_changed_files(parser, flake8_package):
    args = parser.parse_args()

    # changed_files returns file paths relative to the root
    # directory of Spack. Convert to absolute file paths.
    files = changed_files(args)
    files = [os.path.join(spack.paths.prefix, path) for path in files]

    # There will likely be other files that have changed
    # when these tests are run
    assert flake8_package in files
예제 #2
0
파일: flake8.py 프로젝트: LLNL/spack
def test_changed_files(parser, flake8_package):
    args = parser.parse_args()

    # changed_files returns file paths relative to the root
    # directory of Spack. Convert to absolute file paths.
    files = changed_files(args)
    files = [os.path.join(spack.paths.prefix, path) for path in files]

    # There will likely be other files that have changed
    # when these tests are run
    assert flake8_package in files
예제 #3
0
def test_prs_update_old_api():
    """Ensures that every package modified in a PR doesn't contain
    deprecated calls to any method.
    """
    changed_package_files = [
        x for x in flake8.changed_files() if flake8.is_package(x)
    ]
    failing = []
    for file in changed_package_files:
        if 'builtin.mock' not in file:  # don't restrict packages for tests
            name = os.path.basename(os.path.dirname(file))
            pkg = spack.repo.get(name)

            failed = (hasattr(pkg, 'setup_environment')
                      or hasattr(pkg, 'setup_dependent_environment'))
            if failed:
                failing.append(name)

    msg = 'there are {0} packages still using old APIs in this PR [{1}]'
    assert not failing, msg.format(len(failing), ','.join(failing))
예제 #4
0
def test_prs_update_old_api():
    """Ensures that every package modified in a PR doesn't contain
    deprecated calls to any method.
    """
    changed_package_files = [
        x for x in flake8.changed_files() if flake8.is_package(x)
    ]
    failing = []
    for file in changed_package_files:
        if 'builtin.mock' not in file:  # don't restrict packages for tests
            name = os.path.basename(os.path.dirname(file))
            pkg = spack.repo.get(name)

            failed = (hasattr(pkg, 'setup_environment')
                      or hasattr(pkg, 'setup_dependent_environment'))
            if failed:
                failing.append(name)

    msg = ('there are {0} packages using the old API to set build '
           'and run environment [{1}], for further information see '
           'https://github.com/spack/spack/pull/11115')
    assert not failing, msg.format(len(failing), ','.join(failing))