@@ -333,59 +333,47 @@ is expected. Strive to verify the content of the output rather than the syntax.
333
333
For example, the test might verify that a string is included in the output,
334
334
without taking a dependency on where that string occurs in the output.
335
335
336
- ### Using nox
336
+ ### Running tests
337
+
337
338
338
339
Automated testing for samples in ` python-docs-samples ` is managed by
339
340
[ nox] ( https://nox.readthedocs.io ) . Nox allows us to run a variety of tests,
340
341
including the flake8 linter, Python 2.7, Python 3.x, and App Engine tests,
341
342
as well as automated README generation.
342
343
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
+
343
350
To use nox, install it globally with ` pip ` :
344
351
345
352
``` console
346
353
$ pip install nox
347
354
```
348
355
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
+ ```
360
360
361
+ To run tests with a python version, use the correct ` py-3.* ` sessions:
361
362
``` 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
380
364
```
381
365
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
+ ```
384
370
371
+ To run a specific test from a specific following:
385
372
``` console
386
- $ nox -s " lint(sample='./storage/cloud-client') "
373
+ nox -s py-3.7 -- snippets_test.py:test_list_blobs
387
374
```
388
375
376
+
389
377
### Test Environment Setup
390
378
391
379
Because all tests are system tests that use live resources, running tests
0 commit comments