MCPcopy Index your code
hub / github.com/appium/python-client / get_worker_info

Function get_worker_info

test/functional/test_helper.py:114–133  ·  view source on GitHub ↗

Get current worker number and total worker count from pytest-xdist environment variables. Returns: WorkerInfo: Worker information or None values if not running in parallel

()

Source from the content-addressed store, hash-verified

112
113
114def get_worker_info() -> WorkerInfo:
115 """
116 Get current worker number and total worker count from pytest-xdist environment variables.
117
118 Returns:
119 WorkerInfo: Worker information or None values if not running in parallel
120 """
121 worker_number = os.getenv('PYTEST_XDIST_WORKER')
122 worker_count = os.getenv('PYTEST_XDIST_WORKER_COUNT')
123
124 if worker_number and worker_count:
125 # Extract number from worker string like 'gw0', 'gw1', etc.
126 try:
127 worker_num = int(worker_number.replace('gw', ''))
128 total_workers = int(worker_count)
129 return WorkerInfo(worker_number=worker_num, total_workers=total_workers)
130 except (ValueError, AttributeError):
131 pass
132
133 return WorkerInfo(worker_number=None, total_workers=None)
134
135
136def get_wda_port() -> int:

Callers 5

android_device_nameFunction · 0.90
iphone_device_nameFunction · 0.90
get_flutter_system_portFunction · 0.90
device_nameFunction · 0.90
get_wda_portFunction · 0.85

Calls 1

WorkerInfoClass · 0.85

Tested by

no test coverage detected