docstr: Make sure we handle classes with a custom nasty __getattr__ right.
  
  With a custom __getattr__ which e.g. returns a function (like with a
  RPC wrapper), we shouldn't assume this meant "__test__ = True".
docstr_tok: ["Make","sure","we","handle","classes","with","a","custom","nasty","__getattr__","right",".","With","a","custom","__getattr__","which","e.g",".","returns","a","function","(","like","with","a","RPC","wrapper",")",",","we","should","n't","assume","this","meant","``","__test__","=","True","''","."]
code: def test_class_with_nasty_getattr(self, pytester: Pytester) -> None:
      """Make sure we handle classes with a custom nasty __getattr__ right.
  
      With a custom __getattr__ which e.g. returns a function (like with a
      RPC wrapper), we shouldn't assume this meant "__test__ = True".
      """
      # https://github.com/pytest-dev/pytest/issues/1204
      pytester.makepyfile(
          """
              class MetaModel(type):
  
                  def __getattr__(cls, key):
                      return lambda: None
  
  
              BaseModel = MetaModel('Model', (), {})
  
  
              class Model(BaseModel):
  
                  __metaclass__ = MetaModel
  
                  def test_blah(self):
                      pass
          """
      )
      reprec = pytester.inline_run()
      assert not reprec.getfailedcollections()
      call = reprec.getcalls("pytest_collection_modifyitems")[0]
      assert not call.items
  
imports: import pytest
  from _pytest._code import getfslineno
  from _pytest.fixtures import getfixturemarker
  from _pytest.pytester import Pytester
  from _pytest.python import Function
label_desc: Use image node_id 4 for calling the TestNoselikeTestAttribute obj's underlying member method code with example usage: obj.test_class_with_nasty_getattr(pytester) without return types