MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_collect_protocol_method

Method test_collect_protocol_method

testing/test_collection.py:518–534  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

516 assert [x.name for x in self.get_reported_items(hookrec)] == ["test_func"]
517
518 def test_collect_protocol_method(self, pytester: Pytester) -> None:
519 p = pytester.makepyfile(
520 """
521 class TestClass(object):
522 def test_method(self):
523 pass
524 """
525 )
526 normid = p.name + "::TestClass::test_method"
527 for id in [p.name, p.name + "::TestClass", normid]:
528 items, hookrec = pytester.inline_genitems(id)
529 assert len(items) == 1
530 assert items[0].name == "test_method"
531 newid = items[0].nodeid
532 assert newid == normid
533 # ensure we are reporting the collection of the single test item (#2464)
534 assert [x.name for x in self.get_reported_items(hookrec)] == ["test_method"]
535
536 def test_collect_custom_nodes_multi_id(self, pytester: Pytester) -> None:
537 p = pytester.makepyfile("def test_func(): pass")

Callers

nothing calls this directly

Calls 3

get_reported_itemsMethod · 0.95
makepyfileMethod · 0.45
inline_genitemsMethod · 0.45

Tested by

no test coverage detected