diff options
author | Levi Baber <baberlevi@gmail.com> | 2018-10-30 15:44:25 -0500 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2018-10-30 13:44:25 -0700 |
commit | 72fa122101e058f6e07652047aa47cb23efde006 (patch) | |
tree | 31a49a6473282efe1c9f4c366ea189008bec7c56 | |
parent | 718be8a645ea82d3c71b677eccd41c2771e2c32d (diff) | |
download | spack-72fa122101e058f6e07652047aa47cb23efde006.tar.gz spack-72fa122101e058f6e07652047aa47cb23efde006.tar.bz2 spack-72fa122101e058f6e07652047aa47cb23efde006.tar.xz spack-72fa122101e058f6e07652047aa47cb23efde006.zip |
tests: add test for FIXME boilerplate to package_sanity (#9285)
* package_sanity: add test_no_fixme
* cleanup & better assert message
-rw-r--r-- | lib/spack/spack/test/package_sanity.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/spack/spack/test/package_sanity.py b/lib/spack/spack/test/package_sanity.py index 4e22ee29ad..f31209c702 100644 --- a/lib/spack/spack/test/package_sanity.py +++ b/lib/spack/spack/test/package_sanity.py @@ -59,3 +59,28 @@ def test_package_version_consistency(): spack.fetch_strategy.check_pkg_attributes(pkg) for version in pkg.versions: assert spack.fetch_strategy.for_package_version(pkg, version) + + +def test_no_fixme(): + """Packages should not contain any boilerplate such as + FIXME or example.com.""" + errors = [] + fixme_regexes = [ + r'remove this boilerplate', + r'FIXME: Put', + r'FIXME: Add', + r'example.com', + ] + for name in spack.repo.all_package_names(): + repo = spack.repo.Repo(spack.paths.packages_path) + filename = repo.filename_for_package_name(name) + with open(filename, 'r') as package_file: + for i, line in enumerate(package_file): + pattern = next((r for r in fixme_regexes + if re.search(r, line)), None) + if pattern: + errors.append( + "%s:%d: boilerplate needs to be removed: %s" % + (filename, i, line.strip()) + ) + assert [] == errors |