Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.

Commit 3cc0cc2

Browse files
authored
remove replacements in owlbot.py
1 parent deb15ef commit 3cc0cc2

File tree

1 file changed

+0
-215
lines changed

1 file changed

+0
-215
lines changed

owlbot.py

Lines changed: 0 additions & 215 deletions
Original file line numberDiff line numberDiff line change
@@ -161,219 +161,4 @@ def get_staging_dirs(
161161

162162
python.py_samples()
163163

164-
# ----------------------------------------------------------------------------
165-
# Customize noxfile.py
166-
# ----------------------------------------------------------------------------
167-
168-
169-
def place_before(path, text, *before_text, escape=None):
170-
replacement = "\n".join(before_text) + "\n" + text
171-
if escape:
172-
for c in escape:
173-
text = text.replace(c, "\\" + c)
174-
s.replace([path], text, replacement)
175-
176-
177-
open_telemetry_test = """
178-
# XXX Work around Kokoro image's older pip, which borks the OT install.
179-
session.run("pip", "install", "--upgrade", "pip")
180-
constraints_path = str(
181-
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
182-
)
183-
session.install("-e", ".[tracing]", "-c", constraints_path)
184-
# XXX: Dump installed versions to debug OT issue
185-
session.run("pip", "list")
186-
187-
# Run py.test against the unit tests with OpenTelemetry.
188-
session.run(
189-
"py.test",
190-
"--quiet",
191-
"--cov=google.cloud.spanner",
192-
"--cov=google.cloud",
193-
"--cov=tests.unit",
194-
"--cov-append",
195-
"--cov-config=.coveragerc",
196-
"--cov-report=",
197-
"--cov-fail-under=0",
198-
os.path.join("tests", "unit"),
199-
*session.posargs,
200-
)
201-
"""
202-
203-
place_before(
204-
"noxfile.py",
205-
"@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)",
206-
open_telemetry_test,
207-
escape="()",
208-
)
209-
210-
skip_tests_if_env_var_not_set = """# Sanity check: Only run tests if the environment variable is set.
211-
if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", "") and not os.environ.get(
212-
"SPANNER_EMULATOR_HOST", ""
213-
):
214-
session.skip(
215-
"Credentials or emulator host must be set via environment variable"
216-
)
217-
# If POSTGRESQL tests and Emulator, skip the tests
218-
if os.environ.get("SPANNER_EMULATOR_HOST") and database_dialect == "POSTGRESQL":
219-
session.skip("Postgresql is not supported by Emulator yet.")
220-
"""
221-
222-
place_before(
223-
"noxfile.py",
224-
"# Install pyopenssl for mTLS testing.",
225-
skip_tests_if_env_var_not_set,
226-
escape="()",
227-
)
228-
229-
s.replace(
230-
"noxfile.py",
231-
r"""session.install\("-e", "."\)""",
232-
"""session.install("-e", ".[tracing]")""",
233-
)
234-
235-
# Apply manual changes from PR https://github.com/googleapis/python-spanner/pull/759
236-
s.replace(
237-
"noxfile.py",
238-
"""@nox.session\(python=SYSTEM_TEST_PYTHON_VERSIONS\)
239-
def system\(session\):""",
240-
"""@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
241-
@nox.parametrize(
242-
"protobuf_implementation,database_dialect",
243-
[
244-
("python", "GOOGLE_STANDARD_SQL"),
245-
("python", "POSTGRESQL"),
246-
("upb", "GOOGLE_STANDARD_SQL"),
247-
("upb", "POSTGRESQL"),
248-
("cpp", "GOOGLE_STANDARD_SQL"),
249-
("cpp", "POSTGRESQL"),
250-
],
251-
)
252-
def system(session, protobuf_implementation, database_dialect):""",
253-
)
254-
255-
s.replace(
256-
"noxfile.py",
257-
"""\*session.posargs,
258-
\)""",
259-
"""*session.posargs,
260-
env={
261-
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
262-
"SPANNER_DATABASE_DIALECT": database_dialect,
263-
"SKIP_BACKUP_TESTS": "true",
264-
},
265-
)""",
266-
)
267-
268-
s.replace("noxfile.py",
269-
"""env={
270-
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
271-
},""",
272-
"""env={
273-
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
274-
"SPANNER_DATABASE_DIALECT": database_dialect,
275-
"SKIP_BACKUP_TESTS": "true",
276-
},""",
277-
)
278-
279-
s.replace("noxfile.py",
280-
"""session.run\(
281-
"py.test",
282-
"tests/unit",
283-
env={
284-
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
285-
},
286-
\)""",
287-
"""session.run(
288-
"py.test",
289-
"tests/unit",
290-
env={
291-
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
292-
"SPANNER_DATABASE_DIALECT": database_dialect,
293-
"SKIP_BACKUP_TESTS": "true",
294-
},
295-
)""",
296-
)
297-
298-
s.replace(
299-
"noxfile.py",
300-
"""\@nox.session\(python="3.13"\)
301-
\@nox.parametrize\(
302-
"protobuf_implementation",
303-
\[ "python", "upb", "cpp" \],
304-
\)
305-
def prerelease_deps\(session, protobuf_implementation\):""",
306-
"""@nox.session(python="3.13")
307-
@nox.parametrize(
308-
"protobuf_implementation,database_dialect",
309-
[
310-
("python", "GOOGLE_STANDARD_SQL"),
311-
("python", "POSTGRESQL"),
312-
("upb", "GOOGLE_STANDARD_SQL"),
313-
("upb", "POSTGRESQL"),
314-
("cpp", "GOOGLE_STANDARD_SQL"),
315-
("cpp", "POSTGRESQL"),
316-
],
317-
)
318-
def prerelease_deps(session, protobuf_implementation, database_dialect):""",
319-
)
320-
321-
322-
mockserver_test = """
323-
@nox.session(python=DEFAULT_MOCK_SERVER_TESTS_PYTHON_VERSION)
324-
def mockserver(session):
325-
# Install all test dependencies, then install this package in-place.
326-
327-
constraints_path = str(
328-
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
329-
)
330-
# install_unittest_dependencies(session, "-c", constraints_path)
331-
standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES
332-
session.install(*standard_deps, "-c", constraints_path)
333-
session.install("-e", ".", "-c", constraints_path)
334-
335-
# Run py.test against the mockserver tests.
336-
session.run(
337-
"py.test",
338-
"--quiet",
339-
f"--junitxml=unit_{session.python}_sponge_log.xml",
340-
"--cov=google",
341-
"--cov=tests/unit",
342-
"--cov-append",
343-
"--cov-config=.coveragerc",
344-
"--cov-report=",
345-
"--cov-fail-under=0",
346-
os.path.join("tests", "mockserver_tests"),
347-
*session.posargs,
348-
)
349-
350-
"""
351-
352-
place_before(
353-
"noxfile.py",
354-
"def install_systemtest_dependencies(session, *constraints):",
355-
mockserver_test,
356-
escape="()_*:",
357-
)
358-
359-
s.replace(
360-
"noxfile.py",
361-
"install_systemtest_dependencies\(session, \"-c\", constraints_path\)",
362-
"""install_systemtest_dependencies(session, "-c", constraints_path)
363-
364-
# TODO(https://github.com/googleapis/synthtool/issues/1976):
365-
# Remove the 'cpp' implementation once support for Protobuf 3.x is dropped.
366-
# The 'cpp' implementation requires Protobuf<4.
367-
if protobuf_implementation == "cpp":
368-
session.install("protobuf<4")
369-
"""
370-
)
371-
372-
place_before(
373-
"noxfile.py",
374-
"UNIT_TEST_PYTHON_VERSIONS: List[str] = [",
375-
'DEFAULT_MOCK_SERVER_TESTS_PYTHON_VERSION = "3.12"',
376-
escape="[]",
377-
)
378-
379164
s.shell.run(["nox", "-s", "blacken"], hide_output=False)

0 commit comments

Comments
 (0)