Skip to content

Commit 9dac5b2

Browse files
chore: add dependencies for AlloyDBAdminAsyncClient library (#428)
1 parent 7999229 commit 9dac5b2

File tree

3 files changed

+22
-19
lines changed

3 files changed

+22
-19
lines changed

noxfile.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,20 +126,30 @@ def cover(session):
126126
def default(session, path):
127127
# Install all test dependencies, then install this package in-place.
128128
session.install("-r", "requirements-test.txt")
129-
session.install("-e", ".")
129+
session.install(".")
130130
session.install("-r", "requirements.txt")
131131
# Run pytest with coverage.
132+
# Using the coverage command instead of `pytest --cov`, because
133+
# `pytest ---cov` causes the module to be initialized twice, which returns
134+
# this error: "ImportError: PyO3 modules compiled for CPython 3.8 or older
135+
# may only be initialized once per interpreter process". More info about
136+
# this is stated here: https://github.com/pytest-dev/pytest-cov/issues/614.
132137
session.run(
138+
"coverage",
139+
"run",
140+
"--include=*/google/cloud/alloydb/connector/*.py",
141+
"-m",
133142
"pytest",
134-
"--cov=google.cloud.alloydb.connector",
135143
"-v",
136-
"--cov-config=.coveragerc",
137-
"--cov-report=",
138-
"--cov-fail-under=0",
139-
"--junitxml=sponge_log.xml",
140144
path,
141145
*session.posargs,
142146
)
147+
session.run(
148+
"coverage",
149+
"xml",
150+
"-o",
151+
"sponge_log.xml",
152+
)
143153

144154

145155
@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
"requests",
2828
"google-auth",
2929
"protobuf",
30+
"google-cloud-alloydb",
31+
"google-api-core",
3032
]
3133

3234
package_root = os.path.abspath(os.path.dirname(__file__))

tests/unit/test_packaging.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,20 @@
1919

2020

2121
def test_namespace_package_compat(tmp_path: pathlib.PosixPath) -> None:
22-
# The ``google`` namespace package should not be masked
23-
# by the presence of ``google-cloud-alloydb-connector``.
22+
# The ``google`` namespace package should not be masked by the presence of
23+
# `google-cloud-alloydb` and ``google-cloud-alloydb-connector``.
2424
google = tmp_path / "google"
2525
google.mkdir()
2626
google.joinpath("othermod.py").write_text("")
2727
env = dict(os.environ, PYTHONPATH=str(tmp_path))
2828
cmd = [sys.executable, "-m", "google.othermod"]
2929
subprocess.check_call(cmd, env=env)
3030

31-
# The ``google.cloud`` namespace package should not be masked
32-
# by the presence of ``google-cloud-alloydb-connector``.
31+
# The ``google.cloud`` namespace package should not be masked by the presence of
32+
# ``google-cloud-alloydb`` and ``google-cloud-alloydb-connector``.
3333
google_cloud = tmp_path / "google" / "cloud"
3434
google_cloud.mkdir()
3535
google_cloud.joinpath("othermod.py").write_text("")
3636
env = dict(os.environ, PYTHONPATH=str(tmp_path))
3737
cmd = [sys.executable, "-m", "google.cloud.othermod"]
3838
subprocess.check_call(cmd, env=env)
39-
40-
# The ``google.cloud.sql`` namespace package should not be masked
41-
# by the presence of ``google-cloud-alloydb-connector``.
42-
google_cloud_alloydb = tmp_path / "google" / "cloud" / "alloydb"
43-
google_cloud_alloydb.mkdir()
44-
google_cloud_alloydb.joinpath("othermod.py").write_text("")
45-
env = dict(os.environ, PYTHONPATH=str(tmp_path))
46-
cmd = [sys.executable, "-m", "google.cloud.alloydb.othermod"]
47-
subprocess.check_call(cmd, env=env)

0 commit comments

Comments
 (0)