code: def test_enter_leave_pdb_hooks_are_called(
      self, post_mortem, pytester: Pytester
  ) -> None:
      pytester.makeconftest(
          """
              mypdb = None
  
              def pytest_configure(config):
                  config.testing_verification = 'configured'
  
              def pytest_enter_pdb(config, pdb):
                  assert config.testing_verification == 'configured'
                  print('enter_pdb_hook')
  
                  global mypdb
                  mypdb = pdb
                  mypdb.set_attribute = "bar"
  
              def pytest_leave_pdb(config, pdb):
                  assert config.testing_verification == 'configured'
                  print('leave_pdb_hook')
  
                  global mypdb
                  assert mypdb is pdb
                  assert mypdb.set_attribute == "bar"
          """
      )
      p1 = pytester.makepyfile(
          """
              import pytest
  
              def test_set_trace():
                  pytest.set_trace()
                  assert 0
  
              def test_post_mortem():
                  assert 0
          """
      )
      if post_mortem:
          child = pytester.spawn_pytest(
              str(p1) + " --pdb -s -k test_post_mortem"
          )
      else:
          child = pytester.spawn_pytest(str(p1) + " -k test_set_trace")
      child.expect("enter_pdb_hook")
      child.sendline("c")
      if post_mortem:
          child.expect(r"PDB continue")
      else:
          child.expect(r"PDB continue \(IO-capturing resumed\)")
          child.expect("Captured stdout call")
      rest = child.read().decode("utf8")
      assert "leave_pdb_hook" in rest
      assert "1 failed" in rest
      self.flush(child)
  
imports: import os
  import sys
  from typing import List
  import _pytest._code
  import pytest
  from _pytest.debugging import _validate_usepdb_cls
  from _pytest.monkeypatch import MonkeyPatch
  from _pytest.pytester import Pytester
label_desc: Use image node_id 34 for calling the TestPDB obj's underlying member method code with example usage: obj.test_enter_leave_pdb_hooks_are_called(post_mortem, pytester) without return types