code: def pytest_collection_modifyitems(items, config):
      with open("test-list", "w") as f:
          for item in items:
              f.write(item.nodeid + "\n")
  
label_desc: Use image node_id 1 for calling a global function with example usage: pytest_collection_modifyitems(items, config) without return types