(pytester: Pytester)
| 757 | |
| 758 | |
| 759 | def test_matchnodes_two_collections_same_file(pytester: Pytester) -> None: |
| 760 | pytester.makeconftest( |
| 761 | """ |
| 762 | import pytest |
| 763 | def pytest_configure(config): |
| 764 | config.pluginmanager.register(Plugin2()) |
| 765 | |
| 766 | class Plugin2(object): |
| 767 | def pytest_collect_file(self, file_path, parent): |
| 768 | if file_path.suffix == ".abc": |
| 769 | return MyFile2.from_parent(path=file_path, parent=parent) |
| 770 | |
| 771 | def pytest_collect_file(file_path, parent): |
| 772 | if file_path.suffix == ".abc": |
| 773 | return MyFile1.from_parent(path=file_path, parent=parent) |
| 774 | |
| 775 | class MyFile1(pytest.File): |
| 776 | def collect(self): |
| 777 | yield Item1.from_parent(name="item1", parent=self) |
| 778 | |
| 779 | class MyFile2(pytest.File): |
| 780 | def collect(self): |
| 781 | yield Item2.from_parent(name="item2", parent=self) |
| 782 | |
| 783 | class Item1(pytest.Item): |
| 784 | def runtest(self): |
| 785 | pass |
| 786 | |
| 787 | class Item2(pytest.Item): |
| 788 | def runtest(self): |
| 789 | pass |
| 790 | """ |
| 791 | ) |
| 792 | p = pytester.makefile(".abc", "") |
| 793 | result = pytester.runpytest() |
| 794 | assert result.ret == 0 |
| 795 | result.stdout.fnmatch_lines(["*2 passed*"]) |
| 796 | res = pytester.runpytest("%s::item2" % p.name) |
| 797 | res.stdout.fnmatch_lines(["*1 passed*"]) |
| 798 | |
| 799 | |
| 800 | class TestNodeKeywords: |
nothing calls this directly
no test coverage detected