Source code for spack.test.cmd.graph

# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

import sys

import pytest

from spack.main import SpackCommand, SpackCommandError

graph = SpackCommand("graph")

pytestmark = pytest.mark.skipif(sys.platform == "win32", reason="does not run on windows")


[docs]@pytest.mark.db @pytest.mark.usefixtures("mock_packages", "database") def test_graph_ascii(): """Tests spack graph --ascii""" graph("--ascii", "dt-diamond")
[docs]@pytest.mark.db @pytest.mark.usefixtures("mock_packages", "database") def test_graph_dot(): """Tests spack graph --dot""" graph("--dot", "dt-diamond")
[docs]@pytest.mark.db @pytest.mark.usefixtures("mock_packages", "database") def test_graph_static(): """Tests spack graph --static""" graph("--static", "dt-diamond")
[docs]@pytest.mark.db @pytest.mark.usefixtures("mock_packages", "database") def test_graph_installed(): """Tests spack graph --installed""" graph("--installed") with pytest.raises(SpackCommandError): graph("--installed", "dt-diamond")
[docs]@pytest.mark.db @pytest.mark.usefixtures("mock_packages", "database") def test_graph_deptype(): """Tests spack graph --deptype""" graph("--deptype", "all", "dt-diamond")
[docs]def test_graph_no_specs(): """Tests spack graph with no arguments""" with pytest.raises(SpackCommandError): graph()