GeezerVison is showing github.com — feat: add Samples section to CONTRIBUTING.rst (#357) · googleapis/google-cloud-python@ca3cb25
File tree
Expand file treeCollapse file tree
Open diff view settings
packages/google-cloud-logging
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboard +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | docker: |
2 | 2 | image: gcr.io/repo-automation-bots/owlbot-python:latest |
3 | | - digest: sha256:5ff7446edeaede81c3ed58b23a4e76a5403fba1350ce28478045657303b6479d |
| 3 | + digest: sha256:6186535cbdbf6b9fe61f00294929221d060634dae4a0795c1cefdbc995b2d605 |
Collapse file
Copy file name to clipboardExpand all lines: packages/google-cloud-logging/CONTRIBUTING.rst +24Lines changed: 24 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -177,6 +177,30 @@ Build the docs via: |
177 | 177 |
|
178 | 178 | $ nox -s docs |
179 | 179 |
|
| 180 | +************************* |
| 181 | +Samples and code snippets |
| 182 | +************************* |
| 183 | + |
| 184 | +Code samples and snippets live in the `samples/` catalogue. Feel free to |
| 185 | +provide more examples, but make sure to write tests for those examples. |
| 186 | +Each folder containing example code requires its own `noxfile.py` script |
| 187 | +which automates testing. If you decide to create a new folder, you can |
| 188 | +base it on the `samples/snippets` folder (providing `noxfile.py` and |
| 189 | +the requirements files). |
| 190 | + |
| 191 | +The tests will run against a real Google Cloud Project, so you should |
| 192 | +configure them just like the System Tests. |
| 193 | + |
| 194 | +- To run sample tests, you can execute:: |
| 195 | + |
| 196 | + # Run all tests in a folder |
| 197 | + $ cd samples/snippets |
| 198 | + $ nox -s py-3.8 |
| 199 | + |
| 200 | + # Run a single sample test |
| 201 | + $ cd samples/snippets |
| 202 | + $ nox -s py-3.8 -- -k <name of test> |
| 203 | + |
180 | 204 | ******************************************** |
181 | 205 | Note About ``README`` as it pertains to PyPI |
182 | 206 | ******************************************** |
|
Collapse file
Copy file name to clipboardExpand all lines: packages/google-cloud-logging/samples/snippets/noxfile.py +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
28 | 28 | # WARNING - WARNING - WARNING - WARNING - WARNING |
29 | 29 | # WARNING - WARNING - WARNING - WARNING - WARNING |
30 | 30 |
|
31 | | -# Copy `noxfile_config.py` to your directory and modify it instead. |
| 31 | +BLACK_VERSION = "black==19.10b0" |
32 | 32 |
|
| 33 | +# Copy `noxfile_config.py` to your directory and modify it instead. |
33 | 34 |
|
34 | 35 | # `TEST_CONFIG` dict is a configuration hook that allows users to |
35 | 36 | # modify the test configurations. The values here should be in sync |
@@ -159,7 +160,7 @@ def lint(session: nox.sessions.Session) -> None: |
159 | 160 |
|
160 | 161 | @nox.session |
161 | 162 | def blacken(session: nox.sessions.Session) -> None: |
162 | | - session.install("black") |
| 163 | + session.install(BLACK_VERSION) |
163 | 164 | python_files = [path for path in os.listdir(".") if path.endswith(".py")] |
164 | 165 |
|
165 | 166 | session.run("black", *python_files) |
|