(self, pytester: Pytester)
| 743 | assert i != j |
| 744 | |
| 745 | def test_example_items1(self, pytester: Pytester) -> None: |
| 746 | p = pytester.makepyfile( |
| 747 | """ |
| 748 | import pytest |
| 749 | |
| 750 | def testone(): |
| 751 | pass |
| 752 | |
| 753 | class TestX(object): |
| 754 | def testmethod_one(self): |
| 755 | pass |
| 756 | |
| 757 | class TestY(TestX): |
| 758 | @pytest.mark.parametrize("arg0", [".["]) |
| 759 | def testmethod_two(self, arg0): |
| 760 | pass |
| 761 | """ |
| 762 | ) |
| 763 | items, _reprec = pytester.inline_genitems(p) |
| 764 | assert len(items) == 4 |
| 765 | assert items[0].name == "testone" |
| 766 | assert items[1].name == "testmethod_one" |
| 767 | assert items[2].name == "testmethod_one" |
| 768 | assert items[3].name == "testmethod_two[.[]" |
| 769 | |
| 770 | # let's also test getmodpath here |
| 771 | assert items[0].getmodpath() == "testone" # type: ignore[attr-defined] |
| 772 | assert items[1].getmodpath() == "TestX.testmethod_one" # type: ignore[attr-defined] |
| 773 | assert items[2].getmodpath() == "TestY.testmethod_one" # type: ignore[attr-defined] |
| 774 | # PR #6202: Fix incorrect result of getmodpath method. (Resolves issue #6189) |
| 775 | assert items[3].getmodpath() == "TestY.testmethod_two[.[]" # type: ignore[attr-defined] |
| 776 | |
| 777 | s = items[0].getmodpath(stopatmodule=False) # type: ignore[attr-defined] |
| 778 | assert s.endswith("test_example_items1.testone") |
| 779 | print(s) |
| 780 | |
| 781 | def test_classmethod_is_discovered(self, pytester: Pytester) -> None: |
| 782 | """Test that classmethods are discovered""" |
nothing calls this directly
no test coverage detected