Martin Blanchard pushed to branch master at BuildGrid / buildgrid
Commits:
-
45908b7e
by Martin Blanchard at 2018-11-26T10:17:22Z
-
144df7b0
by Martin Blanchard at 2018-11-26T10:23:32Z
3 changed files:
- buildgrid/server/cas/storage/storage_abc.py
- tests/cas/test_services.py
- tests/integration/operations_service.py
Changes:
| ... | ... | @@ -34,7 +34,7 @@ class StorageABC(abc.ABC): |
| 34 | 34 |
@abc.abstractmethod
|
| 35 | 35 |
def has_blob(self, digest):
|
| 36 | 36 |
"""Return True if the blob with the given instance/digest exists."""
|
| 37 |
- pass
|
|
| 37 |
+ raise NotImplementedError()
|
|
| 38 | 38 |
|
| 39 | 39 |
@abc.abstractmethod
|
| 40 | 40 |
def get_blob(self, digest):
|
| ... | ... | @@ -42,14 +42,14 @@ class StorageABC(abc.ABC): |
| 42 | 42 |
|
| 43 | 43 |
If the blob isn't present in storage, return None.
|
| 44 | 44 |
"""
|
| 45 |
- pass
|
|
| 45 |
+ raise NotImplementedError()
|
|
| 46 | 46 |
|
| 47 | 47 |
@abc.abstractmethod
|
| 48 | 48 |
def begin_write(self, digest):
|
| 49 | 49 |
"""Return a file-like object to which a blob's contents could be
|
| 50 | 50 |
written.
|
| 51 | 51 |
"""
|
| 52 |
- pass
|
|
| 52 |
+ raise NotImplementedError()
|
|
| 53 | 53 |
|
| 54 | 54 |
@abc.abstractmethod
|
| 55 | 55 |
def commit_write(self, digest, write_session):
|
| ... | ... | @@ -60,7 +60,7 @@ class StorageABC(abc.ABC): |
| 60 | 60 |
written to the write_session actually matches the digest. The caller
|
| 61 | 61 |
must do that.
|
| 62 | 62 |
"""
|
| 63 |
- pass
|
|
| 63 |
+ raise NotImplementedError()
|
|
| 64 | 64 |
|
| 65 | 65 |
def missing_blobs(self, digests):
|
| 66 | 66 |
"""Return a container containing the blobs not present in CAS."""
|
| ... | ... | @@ -162,7 +162,7 @@ def test_bytestream_write_rejects_wrong_hash(mocked): |
| 162 | 162 |
servicer.Write(requests, context)
|
| 163 | 163 |
context.set_code.assert_called_once_with(grpc.StatusCode.INVALID_ARGUMENT)
|
| 164 | 164 |
|
| 165 |
- assert len(storage.data) is 0
|
|
| 165 |
+ assert not storage.data
|
|
| 166 | 166 |
|
| 167 | 167 |
|
| 168 | 168 |
@pytest.mark.parametrize("instance", instances)
|
| ... | ... | @@ -169,7 +169,7 @@ def test_list_operations_empty(instance, context): |
| 169 | 169 |
|
| 170 | 170 |
response = instance.ListOperations(request, context)
|
| 171 | 171 |
|
| 172 |
- assert len(response.operations) is 0
|
|
| 172 |
+ assert not response.operations
|
|
| 173 | 173 |
|
| 174 | 174 |
|
| 175 | 175 |
# Send execution off, delete, try to find operation should fail
|
| ... | ... | @@ -222,7 +222,7 @@ def test_cancel_operation(instance, controller, execute_request, context): |
| 222 | 222 |
request = operations_pb2.ListOperationsRequest(name=instance_name)
|
| 223 | 223 |
response = instance.ListOperations(request, context)
|
| 224 | 224 |
|
| 225 |
- assert len(response.operations) is 1
|
|
| 225 |
+ assert len(response.operations) == 1
|
|
| 226 | 226 |
|
| 227 | 227 |
for operation in response.operations:
|
| 228 | 228 |
operation_metadata = remote_execution_pb2.ExecuteOperationMetadata()
|
