Skip to content

[release/2.14] Make test/conftest.py LogXMLReruns compatible with pytest 9.2 - #3935

Open
amd-maradosa wants to merge 1 commit into
release/2.14from
maradosa/release-2.14-pytest-9.2-conftest
Open

amd-maradosa wants to merge 1 commit into
release/2.14from
maradosa/release-2.14-pytest-9.2-conftest

Conversation

@amd-maradosa

Copy link
Copy Markdown

Cherry-pick of upstream pytorch#202390 (15e3725).

With pytest 9.2, LogXML.node_reporters is keyed by a NodeId object instead of the string nodeid. LogXMLReruns.node_reporter in test/conftest.py kept a copy of the old pytest code and stored reporters under the string key, so LogXML.finalize raises KeyError at the first test's teardown. With --junit-xml-reruns, every test module exits with code 3 after one case:

INTERNALERROR> reporter = self.node_reporters.pop((node_id, workernode))
INTERNALERROR> KeyError: (NodeId(path='test/test_nn.py', names=('TestNN', 'test_AdaptiveLogSoftmax'), params=None), None)

The fix delegates to LogXML.node_reporter so pytest builds the key, then switches the reporter's class to _NodeReporterReruns.

Only the test/conftest.py part of the upstream commit is included. This branch has no TestJunitXml tests, and the inductor benchmark pytest pin that upstream reverts was never added here.

…est 9.2

pytest 9.2 keys LogXML.node_reporters by a NodeId object instead of the
string nodeid. LogXMLReruns.node_reporter kept a copy of the old pytest
code that stored reporters under the string key, so LogXML.finalize fails
with KeyError at the first test's teardown and every test module aborts
after one case when --junit-xml-reruns is used.

Delegate to LogXML.node_reporter so pytest builds the key, then switch the
reporter's class to _NodeReporterReruns.

Only the test/conftest.py part of the upstream change applies here:
release/2.14 has no TestJunitXml tests, and the inductor benchmark pytest
pin that upstream reverts was never added to this branch.

Upstream: pytorch#202390
(cherry picked from commit 15e3725)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants