diff --git a/.librarian/generator-input/client-post-processing/firestore-integration.yaml b/.librarian/generator-input/client-post-processing/firestore-integration.yaml index fd5fb175852d..6b1c18229ed3 100644 --- a/.librarian/generator-input/client-post-processing/firestore-integration.yaml +++ b/.librarian/generator-input/client-post-processing/firestore-integration.yaml @@ -564,6 +564,31 @@ replacements: "freezegun", ] count: 1 + - paths: [ + packages/google-cloud-firestore/noxfile.py + ] + before: | + SYSTEM_TEST_STANDARD_DEPENDENCIES = \[ + "mock", + "pytest", + "google-cloud-testutils", + \] + after: | + SYSTEM_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "pytest", + ] + count: 1 + - paths: [ + packages/google-cloud-firestore/noxfile.py + ] + before: | + SYSTEM_TEST_LOCAL_DEPENDENCIES: List\[str\] = \[\] + after: | + SYSTEM_TEST_LOCAL_DEPENDENCIES: List[str] = [ + "../google-cloud-testutils" + ] + count: 1 # TODO(https://github.com/googleapis/google-cloud-python/issues/17429): # Temporary post-processing rule to add pytest-xdist dependency. # Remove this once gapic-generator includes pytest-xdist by default. diff --git a/packages/google-cloud-firestore/noxfile.py b/packages/google-cloud-firestore/noxfile.py index 80fe70fa5798..a89acb8a0c38 100644 --- a/packages/google-cloud-firestore/noxfile.py +++ b/packages/google-cloud-firestore/noxfile.py @@ -76,7 +76,6 @@ SYSTEM_TEST_STANDARD_DEPENDENCIES = [ "mock", "pytest", - "google-cloud-testutils", ] SYSTEM_TEST_EXTERNAL_DEPENDENCIES: List[str] = [ "pytest-asyncio==0.21.2", @@ -84,7 +83,7 @@ "pyyaml", "pytest-xdist", ] -SYSTEM_TEST_LOCAL_DEPENDENCIES: List[str] = [] +SYSTEM_TEST_LOCAL_DEPENDENCIES: List[str] = ["../google-cloud-testutils"] SYSTEM_TEST_DEPENDENCIES: List[str] = [] SYSTEM_TEST_EXTRAS: List[str] = [] SYSTEM_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {} diff --git a/packages/google-cloud-firestore/tests/system/test__helpers.py b/packages/google-cloud-firestore/tests/system/test__helpers.py index 228bd0e4362a..83dd476602f2 100644 --- a/packages/google-cloud-firestore/tests/system/test__helpers.py +++ b/packages/google-cloud-firestore/tests/system/test__helpers.py @@ -16,7 +16,7 @@ MISSING_DOCUMENT = "No document to update: " DOCUMENT_EXISTS = "Document already exists: " ENTERPRISE_MODE_ERROR = "only allowed on ENTERPRISE mode" -UNIQUE_RESOURCE_ID = unique_resource_id("-") + "-" + str(os.getpid()) +UNIQUE_RESOURCE_ID = unique_resource_id("-") EMULATOR_CREDS = EmulatorCreds() FIRESTORE_EMULATOR = os.environ.get(_FIRESTORE_EMULATOR_HOST) is not None FIRESTORE_OTHER_DB = os.environ.get("SYSTEM_TESTS_DATABASE", "system-tests-named-db") diff --git a/packages/google-cloud-testutils/test_utils/system.py b/packages/google-cloud-testutils/test_utils/system.py index 18a29303c449..ed513be422bd 100644 --- a/packages/google-cloud-testutils/test_utils/system.py +++ b/packages/google-cloud-testutils/test_utils/system.py @@ -74,7 +74,15 @@ def unique_resource_id(delimiter="_"): testing environments and at particular times. """ build_id = os.getenv("CIRCLE_BUILD_NUM", "") + pid = os.getpid() if build_id == "": - return "%s%d" % (delimiter, 1000 * time.time()) + return "%s%d%s%d" % (delimiter, 1000 * time.time(), delimiter, pid) else: - return "%s%s%s%d" % (delimiter, build_id, delimiter, time.time()) + return "%s%s%s%d%s%d" % ( + delimiter, + build_id, + delimiter, + time.time(), + delimiter, + pid, + )