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)
Once
google-api-core
andgoogleapis-common-protos
have adopted native namespace packaging and removed their__init__.py
files in thegoogle
namespace, then we should add a test that validates that this package and all dependencies do not interfere with further use of thegoogle
namespace.Test follows: