diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2017-10-06 14:13:50 -0400 |
---|---|---|
committer | scheibelp <scheibel1@llnl.gov> | 2017-11-02 18:45:40 -0700 |
commit | ea62347c46064bae1c771ee9825b0b943489b6c1 (patch) | |
tree | 31257b3574d637d916cf875f0cdfd78d53d1c1b2 /lib | |
parent | 41dfba0ba11eb527d7bd47f4a73a33e89c93797e (diff) | |
download | spack-ea62347c46064bae1c771ee9825b0b943489b6c1.tar.gz spack-ea62347c46064bae1c771ee9825b0b943489b6c1.tar.bz2 spack-ea62347c46064bae1c771ee9825b0b943489b6c1.tar.xz spack-ea62347c46064bae1c771ee9825b0b943489b6c1.zip |
view: add a test for extension activation
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/test/cmd/view.py | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/lib/spack/spack/test/cmd/view.py b/lib/spack/spack/test/cmd/view.py new file mode 100644 index 0000000000..0523ab182e --- /dev/null +++ b/lib/spack/spack/test/cmd/view.py @@ -0,0 +1,82 @@ +############################################################################## +# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://github.com/llnl/spack +# Please also see the NOTICE and LICENSE files for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License (as +# published by the Free Software Foundation) version 2.1, February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## +from spack.main import SpackCommand + +activate = SpackCommand('activate') +extensions = SpackCommand('extensions') +install = SpackCommand('install') +view = SpackCommand('view') + + +def test_view_extension( + tmpdir, builtin_mock, mock_archive, mock_fetch, config, + install_mockery): + install('extendee') + install('extension1@1.0') + install('extension1@2.0') + install('extension2@1.0') + viewpath = str(tmpdir.mkdir('view')) + view('symlink', viewpath, 'extension1@1.0') + all_installed = extensions('--show', 'installed', 'extendee') + assert 'extension1@1.0' in all_installed + assert 'extension1@2.0' in all_installed + assert 'extension2@1.0' in all_installed + global_activated = extensions('--show', 'activated', 'extendee') + assert 'extension1@1.0' not in global_activated + assert 'extension1@2.0' not in global_activated + assert 'extension2@1.0' not in global_activated + view_activated = extensions('--show', 'activated', + '-v', viewpath, + 'extendee') + assert 'extension1@1.0' in view_activated + assert 'extension1@2.0' not in view_activated + assert 'extension2@1.0' not in view_activated + + +def test_view_extension_global_activation( + tmpdir, builtin_mock, mock_archive, mock_fetch, config, + install_mockery): + install('extendee') + install('extension1@1.0') + install('extension1@2.0') + install('extension2@1.0') + viewpath = str(tmpdir.mkdir('view')) + view('symlink', viewpath, 'extension1@1.0') + activate('extension1@2.0') + activate('extension2@1.0') + all_installed = extensions('--show', 'installed', 'extendee') + assert 'extension1@1.0' in all_installed + assert 'extension1@2.0' in all_installed + assert 'extension2@1.0' in all_installed + global_activated = extensions('--show', 'activated', 'extendee') + assert 'extension1@1.0' not in global_activated + assert 'extension1@2.0' in global_activated + assert 'extension2@1.0' in global_activated + view_activated = extensions('--show', 'activated', + '-v', viewpath, + 'extendee') + assert 'extension1@1.0' in view_activated + assert 'extension1@2.0' not in view_activated + assert 'extension2@1.0' not in view_activated |