Fix serve long running test (#8268)

This commit is contained in:
Edward Oakes
2020-05-01 11:54:27 -05:00
committed by SangBin Cho
parent f3bed48826
commit 40bb225d7a
3 changed files with 11 additions and 3 deletions
+3
View File
@@ -11,6 +11,9 @@ def _callable_accepts_batch(func_or_class):
class BackendConfig:
def __init__(self, config_dict, accepts_batches=False):
assert isinstance(config_dict, dict)
# Make a copy so that we don't modify the input dict.
config_dict = config_dict.copy()
self.accepts_batches = accepts_batches
self.num_replicas = config_dict.pop("num_replicas", 1)
self.max_batch_size = config_dict.pop("max_batch_size", None)
+5
View File
@@ -9,6 +9,11 @@ def test_backend_config_validation():
with pytest.raises(ValueError, match="unknown_key"):
BackendConfig({"unknown_key": -1})
# Test that the input dict isn't modified.
config = {"num_replicas": 2}
BackendConfig(config)
assert len(config) == 1 and config["num_replicas"] == 2
# Test num_replicas validation.
BackendConfig({"num_replicas": 1})
with pytest.raises(TypeError):