Skip to content

Commit f93453c

Browse files
committed
Update instructions for nox.
1 parent 21a5356 commit f93453c

File tree

1 file changed

+21
-33
lines changed

1 file changed

+21
-33
lines changed

AUTHORING_GUIDE.md

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -333,59 +333,47 @@ is expected. Strive to verify the content of the output rather than the syntax.
333333
For example, the test might verify that a string is included in the output,
334334
without taking a dependency on where that string occurs in the output.
335335

336-
### Using nox
336+
### Running tests
337+
337338

338339
Automated testing for samples in `python-docs-samples` is managed by
339340
[nox](https://nox.readthedocs.io). Nox allows us to run a variety of tests,
340341
including the flake8 linter, Python 2.7, Python 3.x, and App Engine tests,
341342
as well as automated README generation.
342343

344+
__Note:__ As a temporary workaround, each project currently uses first
345+
`noxfile-template.py` found in a parent folder above the current sample. In
346+
order to simulate this locally, you need to copy + rename the parent
347+
`noxfile-template.py` as `noxfile.py` in the folder of the project you want to
348+
run tests.
349+
343350
To use nox, install it globally with `pip`:
344351

345352
```console
346353
$ pip install nox
347354
```
348355

349-
Nox automatically discovers all samples in the repository and generates
350-
three types of sessions for each sample:
351-
352-
1. A test sessions (`gae`, `py27` and `py36`) for running the system tests
353-
against a specific Python version.
354-
2. `lint` sessions for running the style linter.
355-
3. `readmegen` sessions for regenerating READMEs.
356-
357-
Because nox generates all of these sessions, it's often useful to filter down
358-
by just the sample you're working on. For example, if you just want to see
359-
which sessions are available for storage samples:
356+
To run style checks on your samples:
357+
```console
358+
nox -s lint
359+
```
360360

361+
To run tests with a python version, use the correct `py-3.*` sessions:
361362
```console
362-
$ nox -k storage -l
363-
* gae(sample='./appengine/standard/storage/api-client')
364-
* gae(sample='./appengine/standard/storage/appengine-client')
365-
* lint(sample='./appengine/flexible/storage')
366-
* lint(sample='./appengine/standard/storage/api-client')
367-
* lint(sample='./appengine/standard/storage/appengine-client')
368-
* lint(sample='./storage/api')
369-
* lint(sample='./storage/cloud-client')
370-
* lint(sample='./storage/transfer_service')
371-
* py27(sample='./appengine/flexible/storage')
372-
* py27(sample='./storage/api')
373-
* py27(sample='./storage/cloud-client')
374-
* py35(sample='./appengine/flexible/storage')
375-
* py35(sample='./storage/api')
376-
* py35(sample='./storage/cloud-client')
377-
* readmegen(sample='./storage/api')
378-
* readmegen(sample='./storage/cloud-client')
379-
* readmegen(sample='./storage/transfer_service')
363+
nox -s py-3.6
380364
```
381365

382-
Now you can use nox to run a specific session, for example, if you want to
383-
lint the storage cloud-client samples:
366+
To run a specific file:
367+
```console
368+
nox -s py-3.7 -- snippets_test.py
369+
```
384370

371+
To run a specific test from a specific following:
385372
```console
386-
$ nox -s "lint(sample='./storage/cloud-client')"
373+
nox -s py-3.7 -- snippets_test.py:test_list_blobs
387374
```
388375

376+
389377
### Test Environment Setup
390378

391379
Because all tests are system tests that use live resources, running tests

0 commit comments

Comments
 (0)