def METHOD_NAME(mock_packages, mock_archive, mock_fetch, install_mockery):
    """Test that the deprecate command deprecates all dependencies properly."""
    install("libdwarf@20130729 ^libelf@0.8.13")
    install("libdwarf@20130207 ^libelf@0.8.10")
    new_spec = spack.spec.Spec("libdwarf@20130729^libelf@0.8.13").concretized()
    old_spec = spack.spec.Spec("libdwarf@20130207^libelf@0.8.10").concretized()
    all_installed = spack.store.STORE.db.query()
    deprecate("-y", "-d", "libdwarf@20130207", "libdwarf@20130729")
    non_deprecated = spack.store.STORE.db.query()
    all_available = spack.store.STORE.db.query(installed=any)
    deprecated = spack.store.STORE.db.query(installed=InstallStatuses.DEPRECATED)
    assert all_available == all_installed
    assert sorted(all_available) == sorted(deprecated + non_deprecated)
    assert sorted(non_deprecated) == sorted(list(new_spec.traverse()))
    assert sorted(deprecated) == sorted(list(old_spec.traverse()))