Closed Bug 1338531 Opened 7 years ago Closed 7 years ago

[mozlog] suite_start message is never sent when using pytest-mozlog and pytest-xdist

Categories

(Testing :: Mozbase, defect)

Version 3
defect
Not set
normal

Tracking

(firefox54 fixed)

RESOLVED FIXED
mozilla54
Tracking Status
firefox54 --- fixed

People

(Reporter: davehunt, Assigned: davehunt, Mentored)

References

Details

Attachments

(1 file)

Running pytest tests with pytest-mozlog and pytest-xdist does not send the suite_start message, therefore all test_start messages fail with the error: "Got test_start message before suite_start for test XXXX"

Steps to replicate:
1. Install mozlog from mozilla-central and pytest from PyPI
2. Run a suite with "--log-mach=- -n=1"

Expected:
1. "SUITE_START" and "TEST_START" messages appear in the console.

Actual:
1. "ERROR Got test_start message before suite_start for test XXX".
2. "ERROR Got suite_end message before suite_start".
3. SUITE_START and TEST_START messages do not appear in the console.
Assignee: nobody → dave.hunt
Status: NEW → ASSIGNED
Blocks: 1338534
Comment on attachment 8836802 [details]
Bug 1338531 - [mozlog] Collect tests when using pytest-xdist and send suite_start when the first test starts.

https://reviewboard.mozilla.org/r/112124/#review113732

::: testing/mozbase/mozlog/mozlog/pytest_mozlog/plugin.py:66
(Diff revision 2)
> +    def pytest_xdist_node_collection_finished(self, node, ids):
> +        '''Called after each pytest-xdist node collection is completed'''
> +        self._log_suite_start(ids)

I'm not familiar with pytest-xdist.. Will this pass in a different set of tests each time?

If so, then only the first batch will be reported in the suite_start message. In that case it would probably be better not to log any tests at all.

If not, then please close this issue.
Attachment #8836802 - Flags: review?(ahalberstadt) → review+
Blocks: 1339462
Comment on attachment 8836802 [details]
Bug 1338531 - [mozlog] Collect tests when using pytest-xdist and send suite_start when the first test starts.

https://reviewboard.mozilla.org/r/112124/#review113746

::: testing/mozbase/mozlog/mozlog/pytest_mozlog/plugin.py:66
(Diff revision 2)
> +    def pytest_xdist_node_collection_finished(self, node, ids):
> +        '''Called after each pytest-xdist node collection is completed'''
> +        self._log_suite_start(ids)

I checked with the owner of pytest-xdist beforehand, and every node has an identical set of tests. If they ever collected a different set of tests, pytest would raise an exception anway.
Pushed by dhunt@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9a6977ca4eae
[mozlog] Collect tests when using pytest-xdist and send suite_start when the first test starts. r=ahal
https://hg.mozilla.org/mozilla-central/rev/9a6977ca4eae
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
Blocks: 1301494
Blocks: 1375145
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: