Skip to content

Commit 99ad560

Browse files
committed
fix(tests): Use explicit None check for xdist worker number in relay.py
Fix falsy-zero check that masks xdist worker 0 identity. Change from 'xdist._worker_num or 0' to 'xdist._worker_num if xdist._worker_num is not None else 0' to properly distinguish between worker gw0 (_worker_num=0) and non-xdist case (_worker_num=None), matching the pattern used in xdist.py and sentry.py.
1 parent 91a5699 commit 99ad560

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/sentry/testutils/pytest/relay.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def relay_server_setup(live_server, tmpdir_factory):
6868
template_path = _get_template_dir()
6969
sources = ["config.yml", "credentials.json"]
7070

71-
worker_num = xdist._worker_num or 0
71+
worker_num = xdist._worker_num if xdist._worker_num is not None else 0
7272
relay_port = ephemeral_port_reserve.reserve(ip="127.0.0.1", port=33331 + worker_num * 100)
7373

7474
redis_db = xdist.get_redis_db()

0 commit comments

Comments
 (0)