Skip to content

Commit d6789bd

Browse files
Takashi Matsuobusunkim96
authored andcommitted
testing: various cleanups [(#3877)](GoogleCloudPlatform/python-docs-samples#3877)
* testing: various cleanups * [iap]: only run iap tests on Kokoro * [vision/automl]: use temporary directory for temporary files * [appengine/flexible/scipy]: use temporary directory * [bigtable/snippets/reads]: update pytest snapshot * [texttospeech/cloud-client]: added output.mp3 to .gitignore * [iot/api-client/gcs_file_to_device]: use temporary directory * [iot/api-client/mqtt_example]: use temporary directory * [logging/cloud-client]: use uuid and add backoff * use project directory with Trampoline V1
1 parent ff2cea8 commit d6789bd

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

samples/snippets/snippets_test.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import uuid
16+
1517
import backoff
18+
from google.api_core.exceptions import NotFound
1619
from google.cloud import logging
1720
import pytest
1821

1922
import snippets
2023

2124

22-
TEST_LOGGER_NAME = 'example_log'
25+
TEST_LOGGER_NAME = 'example_log_{}'.format(uuid.uuid4().hex)
2326

2427

2528
@pytest.fixture
@@ -46,6 +49,8 @@ def test_write():
4649

4750

4851
def test_delete(example_log, capsys):
49-
snippets.delete_logger(TEST_LOGGER_NAME)
50-
out, _ = capsys.readouterr()
51-
assert TEST_LOGGER_NAME in out
52+
@backoff.on_exception(backoff.expo, NotFound, max_time=120)
53+
def eventually_consistent_test():
54+
snippets.delete_logger(TEST_LOGGER_NAME)
55+
out, _ = capsys.readouterr()
56+
assert TEST_LOGGER_NAME in out

0 commit comments

Comments
 (0)