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

Commit ff8902e

Browse files
feat: add golden testing (#262)
* test: add initial test data and update gitignore * test: add missing file * test: add goldens * test: add golden test * test: update gapic-combo to pubsub from bigquery * test: update goldens * test: remove unused tests * chore: remove further unused files * test: update golden test logic for repo * test: update goldens with new repo test: omit gapic-combo test: include gapic-combo again in goldens * fix: sort TOC alphabetically by href * test: restrict to 3.9 * test: address review comments for test_goldens * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: update presubmit name * fix: address review comment Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent b66f42b commit ff8902e

444 files changed

Lines changed: 92518 additions & 1997 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yaml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: ci
1+
name: Presubmit tests
22

33
on: [push]
44

@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
python-version: [3.7, 3.8, 3.9]
10+
python-version: [3.9]
1111

1212
steps:
1313
- uses: actions/checkout@v3
@@ -21,11 +21,5 @@ jobs:
2121
pip install tox
2222
- name: Run tests
2323
run: |
24-
tox -e docs
25-
- name: Run unittest
26-
run: |
27-
tox -e unittest
28-
- name: Run librarytest
29-
run: |
30-
tox -e librarytest
24+
tox -e tests
3125

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ pip-log.txt
4646

4747
# Built documentation
4848
docs/_build
49+
tests/testdata/*/docs/_build
4950
bigquery/docs/generated
5051
docs.metadata
5152

appveyor.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

debug.py

Lines changed: 0 additions & 41 deletions
This file was deleted.

docfx_yaml/markdown_utils.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,9 @@ def move_markdown_pages(app: sphinx.application, outdir: Path) -> None:
259259
print("There's no markdown file to move.")
260260
return
261261

262+
# Used to keep track of the index page entry to insert later.
263+
index_page_entry = None
264+
262265
# For each file, if it is a markdown file move to the top level pages.
263266
for mdfile in markdown_dir.iterdir():
264267
if mdfile.is_file() and mdfile.name.lower() not in files_to_ignore:
@@ -291,11 +294,11 @@ def move_markdown_pages(app: sphinx.application, outdir: Path) -> None:
291294

292295
# Use Overview as the name for index file.
293296
if mdfile_name_to_use == 'index.md':
294-
# Place the Overview page at the top of the list.
295-
app.env.markdown_pages.insert(
296-
0,
297-
{'name':'Overview', 'href': 'index.md'}
298-
)
297+
# Save the index page entry.
298+
index_page_entry = {
299+
'name': 'Overview',
300+
'href': 'index.md'
301+
}
299302
continue
300303

301304
# Add the file to the TOC later.
@@ -304,6 +307,22 @@ def move_markdown_pages(app: sphinx.application, outdir: Path) -> None:
304307
'href': mdfile_name_to_use,
305308
})
306309

310+
if app.env.markdown_pages:
311+
# Sort the TOC alphabetically based on href entry.
312+
app.env.markdown_pages = sorted(
313+
app.env.markdown_pages,
314+
key=lambda entry: entry['href'],
315+
)
316+
317+
if index_page_entry is None:
318+
return
319+
320+
# Place the Overview page at the top of the list.
321+
app.env.markdown_pages.insert(
322+
0,
323+
index_page_entry,
324+
)
325+
307326

308327
def run_sphinx_markdown() -> None:
309328
"""Runs sphinx-build with Markdown builder in the plugin."""

old_appveyor.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

requirements.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1+
# Install Sphinx plugin
2+
-e .
3+
4+
# Tox specific dependencies
5+
tox
6+
mock
7+
pytest
8+
9+
# Other dependencies
110
black==22.10.0
211
parameterized==0.8.1
312
# google-resumable-media-python requires manual update as this repo isn't templated.
413
# python-api-core also requires manual update as it is not templated.
514
sphinx==4.5.0
615
-e .
7-
tox
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
1-
# Copyright 2021 Google LLC
1+
# Copyright 2022 Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
55
# You may obtain a copy of the License at
66
#
7-
# http://www.apache.org/licenses/LICENSE-2.0
7+
# https://www.apache.org/licenses/LICENSE-2.0
88
#
99
# Unless required by applicable law or agreed to in writing, software
1010
# distributed under the License is distributed on an "AS IS" BASIS,
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# Don't build any extra formats
15+
import pytest
1616

17-
formats:
18-
- none
19-
python:
20-
version: 3
21-
setup_py_install: true
2217

18+
def pytest_addoption(parser):
19+
parser.addoption("--update-goldens", action="store", default=False)
20+
21+
22+
@pytest.fixture
23+
def update_goldens(request):
24+
return request.config.getoption("--update-goldens")

0 commit comments

Comments
 (0)