{"id":24430,"library":"pytest-item-dict","title":"pytest-item-dict","description":"A pytest plugin that provides a hierarchical dict of session.items, enabling easy access to test items by node ID or custom keys. Current version 1.1.2, requires Python >=3.11. Released as needed.","status":"active","version":"1.1.2","language":"python","source_language":"en","source_url":"https://github.com/anogowski/pytest-item-dict","tags":["pytest","plugin","test-collection","hierarchical-dict","item-dict"],"install":[{"cmd":"pip install pytest-item-dict","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"Plugin extends pytest session","package":"pytest","optional":false}],"imports":[{"note":"Correct function is item_dict, not get_item_dict.","wrong":"from pytest_item_dict import get_item_dict","symbol":"item_dict","correct":"from pytest_item_dict import item_dict"}],"quickstart":{"code":"import pytest\nfrom pytest_item_dict import item_dict\n\npytest.main(['-v', '--collect-only'])\n# Access items via item_dict()\nitems = item_dict()\nprint(items.keys())","lang":"python","description":"Collect tests and get hierarchical dict."},"warnings":[{"fix":"Ensure pytest session has run before calling item_dict().","message":"item_dict() can only be called after pytest session has collected items, typically after a test run or --collect-only.","severity":"gotcha","affected_versions":"all"},{"fix":"Use node IDs as keys or extend the plugin for custom keys.","message":"The hierarchical dict keys are based on node IDs; custom keys require modifying the plugin.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run pytest with --collect-only or after a test session.","cause":"Called before pytest collects items.","error":"pytest_item_dict.item_dict() returns empty dict"},{"fix":"Use 'from pytest_item_dict import item_dict' and upgrade to >=1.0.0.","cause":"Wrong import path or older version.","error":"ImportError: cannot import name 'item_dict' from 'pytest_item_dict'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}