Skip to content

Commit

Permalink
chore: fix kokoro config for samples (#426)
Browse files Browse the repository at this point in the history
Source-Link: googleapis/synthtool@dd05f9d
Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:aea14a583128771ae8aefa364e1652f3c56070168ef31beb203534222d842b8b
  • Loading branch information
gcf-owl-bot[bot] committed Aug 9, 2021
1 parent a1c52be commit a2b81be
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/.OwlBot.lock.yaml
@@ -1,3 +1,3 @@
docker:
image: gcr.io/repo-automation-bots/owlbot-python:latest
digest: sha256:5ff7446edeaede81c3ed58b23a4e76a5403fba1350ce28478045657303b6479d
digest: sha256:aea14a583128771ae8aefa364e1652f3c56070168ef31beb203534222d842b8b
2 changes: 1 addition & 1 deletion .kokoro/samples/python3.6/periodic-head.cfg
Expand Up @@ -7,5 +7,5 @@ env_vars: {

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-pubsub/.kokoro/test-samples-against-head.sh"
value: "github/python-spanner/.kokoro/test-samples-against-head.sh"
}
2 changes: 1 addition & 1 deletion .kokoro/samples/python3.7/periodic-head.cfg
Expand Up @@ -7,5 +7,5 @@ env_vars: {

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-pubsub/.kokoro/test-samples-against-head.sh"
value: "github/python-spanner/.kokoro/test-samples-against-head.sh"
}
2 changes: 1 addition & 1 deletion .kokoro/samples/python3.8/periodic-head.cfg
Expand Up @@ -7,5 +7,5 @@ env_vars: {

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-pubsub/.kokoro/test-samples-against-head.sh"
value: "github/python-spanner/.kokoro/test-samples-against-head.sh"
}
2 changes: 1 addition & 1 deletion .kokoro/samples/python3.9/periodic-head.cfg
Expand Up @@ -7,5 +7,5 @@ env_vars: {

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-pubsub/.kokoro/test-samples-against-head.sh"
value: "github/python-spanner/.kokoro/test-samples-against-head.sh"
}
24 changes: 24 additions & 0 deletions CONTRIBUTING.rst
Expand Up @@ -177,6 +177,30 @@ Build the docs via:

$ nox -s docs

*************************
Samples and code snippets
*************************

Code samples and snippets live in the `samples/` catalogue. Feel free to
provide more examples, but make sure to write tests for those examples.
Each folder containing example code requires its own `noxfile.py` script
which automates testing. If you decide to create a new folder, you can
base it on the `samples/samples` folder (providing `noxfile.py` and
the requirements files).

The tests will run against a real Google Cloud Project, so you should
configure them just like the System Tests.

- To run sample tests, you can execute::

# Run all tests in a folder
$ cd samples/samples
$ nox -s py-3.8

# Run a single sample test
$ cd samples/samples
$ nox -s py-3.8 -- -k <name of test>

********************************************
Note About ``README`` as it pertains to PyPI
********************************************
Expand Down
3 changes: 3 additions & 0 deletions owlbot.py
Expand Up @@ -121,6 +121,9 @@ def get_staging_dirs(
"\n\g<0>",
)

# Update samples folder in CONTRIBUTING.rst
s.replace("CONTRIBUTING.rst", "samples/snippets", "samples/samples")

# ----------------------------------------------------------------------------
# Samples templates
# ----------------------------------------------------------------------------
Expand Down
5 changes: 3 additions & 2 deletions samples/samples/noxfile.py
Expand Up @@ -28,8 +28,9 @@
# WARNING - WARNING - WARNING - WARNING - WARNING
# WARNING - WARNING - WARNING - WARNING - WARNING

# Copy `noxfile_config.py` to your directory and modify it instead.
BLACK_VERSION = "black==19.10b0"

# Copy `noxfile_config.py` to your directory and modify it instead.

# `TEST_CONFIG` dict is a configuration hook that allows users to
# modify the test configurations. The values here should be in sync
Expand Down Expand Up @@ -159,7 +160,7 @@ def lint(session: nox.sessions.Session) -> None:

@nox.session
def blacken(session: nox.sessions.Session) -> None:
session.install("black")
session.install(BLACK_VERSION)
python_files = [path for path in os.listdir(".") if path.endswith(".py")]

session.run("black", *python_files)
Expand Down

0 comments on commit a2b81be

Please sign in to comment.