code: def pytest_collection_modifyitems(config, items):
      test_stages = set(config.getoption("--stage"))
  
      # add dynamic markers
      lax = config.getoption("--lax")
      if lax:
          _add_marker(pytest.mark.xfail(raises=AssertionError), items)
  
      # select / deselect tests based on stage criterion
      if not test_stages or "all" in test_stages:
          return
      selected_items = []
      deselected_items = []
      for item in items:
          stage_marker = item.get_closest_marker("stage")
          if not stage_marker:
              selected_items.append(item)
              warnings.warn(
                  "No stage associated with the test {}. Will run on each stage invocation.".format(
                      item.name
                  )
              )
              continue
          item_stage_markers = _get_highest_specificity_marker(
              stage_marker
          )
          if test_stages.isdisjoint(item_stage_markers):
              deselected_items.append(item)
          else:
              selected_items.append(item)
      config.hook.pytest_deselected(items=deselected_items)
      items[:] = selected_items
  
file_path: pyro/tests/conftest.py
imports: import os
  import warnings
  import pytest
  import torch
  import pyro
label_desc: Use image node_id 6 for calling a global function with example usage: pytest_collection_modifyitems(config, items) without return types