Skip to content

Add a system test to ensure the "google" namespace isn't clobbered #15980

Description

@andrewsg

Once google-api-core and googleapis-common-protos have adopted native namespace packaging and removed their __init__.py files in the google namespace, then we should add a test that validates that this package and all dependencies do not interfere with further use of the google namespace.

Test follows:

import os
import subprocess
import sys
import tempfile
def test_namespace_package_compat():
"""
The ``google`` namespace package should not be masked
by the presence of this package.
"""
with tempfile.TemporaryDirectory() as tmp_path:
google = tmp_path + "/google"
os.mkdir(google)
path = os.path.join(google, "othermod.py")
with open(path, "w") as f:
f.write("pass")
env = dict(os.environ, PYTHONPATH=tmp_path)
cmd = [sys.executable, "-m", "google.othermod"]
subprocess.check_call(cmd, env=env)

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: storageIssues related to the Cloud Storage API.type: cleanupAn internal cleanup or hygiene concern.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions