Skip to content
This repository was archived by the owner on Sep 1, 2024. It is now read-only.

Commit 138c66a

Browse files
committed
Avoid fetching manifest in xdist workers on failure
xdist workers don't have access to the API key and cannot fetch the manifest. Prior to this change, the xdist worker would attempt to fetch the manifest if the fetch attempt in the parent process failed. This change fixes the bug so that xdist workers will never attempt to fetch the manifest, even if the fetch in the parent process failed.
1 parent c6ab89a commit 138c66a

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/pytest_unflakable/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ def pytest_configure(config: Config) -> None:
159159
insecure_disable_tls_validation = config.getoption(
160160
'unflakable_insecure_disable_tls_validation', False)
161161
manifest = None
162-
if is_xdist_worker and 'unflakable_manifest' in config.workerinput: # type: ignore
163-
manifest = config.workerinput['unflakable_manifest'] # type: ignore
162+
if is_xdist_worker:
163+
manifest = config.workerinput.get('unflakable_manifest') # type: ignore
164164
logger.debug(
165165
f'xdist worker received manifest for test suite {test_suite_id}: '
166166
f'{pprint.pformat(manifest)}'

src/pytest_unflakable/_plugin.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ def pytest_configure_node(self, node: Any) -> None:
165165
"""
166166
nodeid = node.workerinput['workerid']
167167
self.logger.debug(f'called hook pytest_configure_node: {nodeid}')
168-
if self.manifest is not None:
169-
node.workerinput['unflakable_manifest'] = self.manifest
168+
node.workerinput['unflakable_manifest'] = self.manifest
170169

171170

172171
class UnflakablePlugin:

0 commit comments

Comments
 (0)