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))
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))