You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: samples/README.md
+63-51Lines changed: 63 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,6 +41,69 @@ for more detailed instructions.
41
41
pip install -r requirements.txt
42
42
```
43
43
44
+
45
+
## Running tests locally
46
+
47
+
Before running the tests, make sure you've followed the steps outlined in
48
+
[Setup](#setup).
49
+
50
+
### Install nox
51
+
52
+
We use [nox](https://nox.readthedocs.io/en/latest/) to instrument our tests.
53
+
54
+
```
55
+
pip install nox
56
+
```
57
+
58
+
### Set environment variables
59
+
60
+
You can run tests locally using your own gcs project or with a valid service account in project `python-docs-samples-tests`. This outlines the workflow of running tests locally using your own gcs project.
61
+
62
+
Refer to [`noxfile_config.py`](https://github.com/googleapis/python-storage/blob/main/samples/snippets/noxfile_config.py) and [a list of environment variables](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/testing/test-env.tmpl.sh) that can be set manually. Not every test needs all of these variables.
63
+
Below outlines some common environment variables used in the storage samples.
64
+
See [Other Resources](#other-resources) on how to create credentials, keys, and secrets.
If you are running a single test locally that does not use the environment variables, you can delete the `noxfile_config.py` file and simply set your `GOOGLE_CLOUD_PROJECT`
There are restrictions on the testing projects used in Kokoro. For instance,
89
+
we change the service account based on different test sessions to avoid
90
+
hitting the maximum limit of HMAC keys on a single service account.
91
+
Another example is `requester_pays_test.py` needs to use a different Storage bucket, and looks for an environment variable `REQUESTER_PAYS_TEST_BUCKET`.
92
+
Please refer to [`noxfile_config.py`](https://github.com/googleapis/python-storage/blob/main/samples/snippets/noxfile_config.py) , [kokoro configs](https://github.com/googleapis/python-storage/tree/main/.kokoro/samples), and test files to see if there are special test configurations required.
Before running the tests, make sure you've followed the steps outlined in
1118
-
[Setup](#setup).
1119
-
1120
-
### Install nox
1121
-
```
1122
-
pip install nox
1123
-
```
1124
-
1125
-
### Set environment variables
1126
-
1127
-
You can run tests locally using your own gcs project or with a valid service account in project `python-docs-samples-tests`. This outlines the workflow of running tests locally using your own gcs project.
1128
-
1129
-
Refer to [`noxfile_config.py`](https://github.com/googleapis/python-storage/blob/main/samples/snippets/noxfile_config.py) and [a list of environment variables](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/testing/test-env.tmpl.sh) that can be set manually. Not every test needs all of these variables.
1130
-
The common environment variables used in the storage samples include:
There are restrictions on the testing projects used in Kokoro. For instance,
1150
-
we change the service account based on different test sessions to avoid
1151
-
hitting the maximum limit of HMAC keys on a single service account.
1152
-
Another example is `requester_pays_test.py` needs to use a different Storage bucket, and looks for an environment variable `REQUESTER_PAYS_TEST_BUCKET`.
1153
-
Please refer to [`noxfile_config.py`](https://github.com/googleapis/python-storage/blob/main/samples/snippets/noxfile_config.py) , [kokoro configs](https://github.com/googleapis/python-storage/tree/main/.kokoro/samples), and test files to see if there are special test configurations required.
0 commit comments