code: def test_skip_graph_checks(dvc, mocker):
      # See https://github.com/iterative/dvc/issues/2671 for more info
      mock_build_graph = mocker.spy(Index.graph, "fget")
  
      # sanity check
      Index(dvc).check_graph()
      assert mock_build_graph.called
      mock_build_graph.reset_mock()
  
      # check that our hack can be enabled
      dvc._skip_graph_checks = True
      Index(dvc).check_graph()
      assert not mock_build_graph.called
      mock_build_graph.reset_mock()
  
      # check that our hack can be disabled
      dvc._skip_graph_checks = False
      Index(dvc).check_graph()
      assert mock_build_graph.called
  
imports: import os
  from itertools import chain
  import pytest
  from pygtrie import Trie
  from dvc.repo.index import Index
  from dvc.stage import Stage
label_desc: Use image node_id 7 for calling a global function with example usage: test_skip_graph_checks(dvc, mocker) without return types