code: def test_collect_only_with_various_situations(
      self, pytester: Pytester
  ) -> None:
      p = pytester.makepyfile(
          test_one="""
                  def test_one():
                      raise ValueError()
  
                  class TestX(object):
                      def test_method_one(self):
                          pass
  
                  class TestY(TestX):
                      pass
              """,
          test_three="xxxdsadsadsadsa",
          __init__="",
      )
      reprec = pytester.inline_run("--collect-only", p.parent)
  
      itemstarted = reprec.getcalls("pytest_itemcollected")
      assert len(itemstarted) == 3
      assert not reprec.getreports("pytest_runtest_logreport")
      started = reprec.getcalls("pytest_collectstart")
      finished = reprec.getreports("pytest_collectreport")
      assert len(started) == len(finished)
      assert len(started) == 6
      colfail = [x for x in finished if x.failed]
      assert len(colfail) == 1
  
imports: import pytest
  from _pytest.config import ExitCode
  from _pytest.monkeypatch import MonkeyPatch
  from _pytest.pytester import Pytester
label_desc: Use image node_id 2 for calling the TestNewSession obj's underlying member method code with example usage: obj.test_collect_only_with_various_situations(pytester) without return types