googleapis / googleapis/google-cloud-python

Set `random.seed` explicitly in each test function for rest streaming

Đang mở
#15,051 1 bình luận 0 reaction 1 người được giao Được @ohmayr nhận Xem trên GitHub
priority: p2 type: process
Ngôn ngữ chính
Python
Star
5.4k
Fork
1.8k
Merge trung bình
3 ngày 4 giờ
Pull request đã merge (30 ngày)
122

Mô tả

Currently, the tests for rest streaming depend on a single seed value configured globally within the file [here](https://github.com/googleapis/python-api-core/blob/main/tests/unit/test_rest_streaming.py#L35). This makes the tests non-deterministic and inter-dependent making it difficult to understand and debug test failures.

Instead, we can either:

- set `random.seed` explicitly in each test function. The value can either be hard-coded in (recommended), or it can be varying (by passing in, say, an integer based on time of day, PID, etc.) .

or

- pass in the seed to the constructor of `_ResponseItr` within the test file.

In either case, make sure the logs and / or errors print out what the value of the seed turned out to be, so that if we encounter the same failure, we can make sure the test function sets the same seed so we can replicate it.

Also do the same for the test cases of asynchronous rest streaming once implemented. See: [async rest]streaming(https://github.com/googleapis/python-api-core/pull/686)

Reference: https://github.com/googleapis/python-api-core/pull/686#discussion_r1729542731

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.