From 924061492839d385a2fdaaba213928bb0198b746 Mon Sep 17 00:00:00 2001 From: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com> Date: Wed, 15 Dec 2021 21:55:28 -0800 Subject: [PATCH] Bugfix: Simplify preferred-test versions; set checksum defaults (#28026) * Simplify preferred-test versions; set checksum defaults * Fix test_preferred failure --- lib/spack/spack/cmd/checksum.py | 8 ++++---- lib/spack/spack/test/cmd/audit.py | 2 +- lib/spack/spack/test/cmd/checksum.py | 4 ++-- lib/spack/spack/test/concretize_preferences.py | 10 +++++----- .../builtin.mock/packages/preferred-test/package.py | 12 +++++------- 5 files changed, 17 insertions(+), 19 deletions(-) diff --git a/lib/spack/spack/cmd/checksum.py b/lib/spack/spack/cmd/checksum.py index b2a2bc5891..4796ed2500 100644 --- a/lib/spack/spack/cmd/checksum.py +++ b/lib/spack/spack/cmd/checksum.py @@ -25,17 +25,17 @@ def setup_parser(subparser): subparser.add_argument( - '--keep-stage', action='store_true', + '--keep-stage', action='store_true', default=False, help="don't clean up staging area when command completes") sp = subparser.add_mutually_exclusive_group() sp.add_argument( - '-b', '--batch', action='store_true', + '-b', '--batch', action='store_true', default=False, help="don't ask which versions to checksum") sp.add_argument( - '-l', '--latest', action='store_true', + '-l', '--latest', action='store_true', default=False, help="checksum the latest available version only") sp.add_argument( - '-p', '--preferred', action='store_true', + '-p', '--preferred', action='store_true', default=False, help="checksum the preferred version only") arguments.add_common_arguments(subparser, ['package']) subparser.add_argument( diff --git a/lib/spack/spack/test/cmd/audit.py b/lib/spack/spack/test/cmd/audit.py index 2c9dc6b124..e7fe2d68da 100644 --- a/lib/spack/spack/test/cmd/audit.py +++ b/lib/spack/spack/test/cmd/audit.py @@ -41,7 +41,7 @@ def test_audit_packages_https(mutable_config, mock_packages): assert audit.returncode == 1 # This uses http and should fail - audit('packages-https', "preferred-test", fail_on_error=False) + audit('packages-https', "test-dependency", fail_on_error=False) assert audit.returncode == 1 # providing one or more package names with https should work diff --git a/lib/spack/spack/test/cmd/checksum.py b/lib/spack/spack/test/cmd/checksum.py index 6c05b03d59..c741377ce6 100644 --- a/lib/spack/spack/test/cmd/checksum.py +++ b/lib/spack/spack/test/cmd/checksum.py @@ -30,7 +30,7 @@ def test_checksum_args(arguments, expected): @pytest.mark.parametrize('arguments,expected', [ - (['--batch', 'preferred-test'], 'versions of preferred-test'), + (['--batch', 'preferred-test'], 'version of preferred-test'), (['--latest', 'preferred-test'], 'Found 1 version'), (['--preferred', 'preferred-test'], 'Found 1 version'), ]) @@ -47,7 +47,7 @@ def _get_number(*args, **kwargs): monkeypatch.setattr(tty, 'get_number', _get_number) output = spack_checksum('preferred-test') - assert 'versions of preferred-test' in output + assert 'version of preferred-test' in output assert 'version(' in output diff --git a/lib/spack/spack/test/concretize_preferences.py b/lib/spack/spack/test/concretize_preferences.py index 733e3efa77..80d9b0eb94 100644 --- a/lib/spack/spack/test/concretize_preferences.py +++ b/lib/spack/spack/test/concretize_preferences.py @@ -176,16 +176,16 @@ def test_preferred_providers(self): def test_preferred(self): """"Test packages with some version marked as preferred=True""" - spec = Spec('preferred-test') + spec = Spec('python') spec.concretize() - assert spec.version == Version('0.2.15') + assert spec.version == Version('2.7.11') # now add packages.yaml with versions other than preferred # ensure that once config is in place, non-preferred version is used - update_packages('preferred-test', 'version', ['0.2.16']) - spec = Spec('preferred-test') + update_packages('python', 'version', ['3.5.0']) + spec = Spec('python') spec.concretize() - assert spec.version == Version('0.2.16') + assert spec.version == Version('3.5.0') def test_develop(self): """Test concretization with develop-like versions""" diff --git a/var/spack/repos/builtin.mock/packages/preferred-test/package.py b/var/spack/repos/builtin.mock/packages/preferred-test/package.py index 41ee58aeb6..2ef586192a 100644 --- a/var/spack/repos/builtin.mock/packages/preferred-test/package.py +++ b/var/spack/repos/builtin.mock/packages/preferred-test/package.py @@ -7,11 +7,9 @@ class PreferredTest(Package): - """Dummy package with develop version and preffered version""" - homepage = "http://www.openblas.net" - url = "http://github.com/xianyi/OpenBLAS/archive/v0.2.15.tar.gz" + """Dummy package with develop version and preferred version""" + homepage = "https://github.com/LLNL/mpileaks" + url = "https://github.com/LLNL/mpileaks/releases/download/v1.0/mpileaks-1.0.tar.gz" - version('develop', git='https://github.com/dummy/repo.git') - version('0.2.16', 'b1190f3d3471685f17cfd1ec1d252ac9') - version('0.2.15', 'b1190f3d3471685f17cfd1ec1d252ac9', preferred=True) - version('0.2.14', 'b1190f3d3471685f17cfd1ec1d252ac9') + version('develop', git='https://github.com/LLNL/mpileaks.git') + version('1.0', sha256='2e34cc4505556d1c1f085758e26f2f8eea0972db9382f051b2dcfb1d7d9e1825', preferred=True)