docstr: Test get_all_specs in subclasses that override find_kernel_specs
docstr_tok: ["Test","get_all_specs","in","subclasses","that","override","find_kernel_specs"]
code: def test_subclass(self):
      """Test get_all_specs in subclasses that override find_kernel_specs"""
      ksm = self.ksm
      resource_dir = tempfile.gettempdir()
      native_name = kernelspec.NATIVE_KERNEL_NAME
      native_kernel = ksm.get_kernel_spec(native_name)
  
      class MyKSM(kernelspec.KernelSpecManager):
          def get_kernel_spec(self, name):
              spec = copy.copy(native_kernel)
              if name == "fake":
                  spec.name = name
                  spec.resource_dir = resource_dir
              elif name == native_name:
                  pass
              else:
                  raise KeyError(name)
              return spec
  
          def find_kernel_specs(self):
              return {
                  "fake": resource_dir,
                  native_name: native_kernel.resource_dir,
              }
  
      # ensure that get_all_specs doesn't raise if only
      # find_kernel_specs and get_kernel_spec are defined
      myksm = MyKSM()
      specs = myksm.get_all_specs()
      assert sorted(specs) == ["fake", native_name]
  
imports: import copy
  import json
  import os
  import sys
  import tempfile
  import unittest
  from io import StringIO
  from logging import StreamHandler
  from os.path import join
  from subprocess import PIPE, STDOUT, Popen
  from tempfile import TemporaryDirectory
  import pytest
  from jupyter_core import paths
  from jupyter_client import kernelspec
  from .utils import install_kernel, sample_kernel_json
label_desc: Use image node_id 14 for calling the KernelSpecTests obj's underlying member method code with example usage: obj.test_subclass() and returns: spec, dict