@@ -85,6 +85,8 @@ information on using pull requests.
85
85
86
86
### Initial Setup
87
87
88
+ You need Python 2.7 or Python 3.4+ to build and test the code in this repo.
89
+
88
90
We recommend using [ pip] ( https://pypi.python.org/pypi/pip ) for installing the necessary tools and
89
91
project dependencies. Most recent versions of Python ship with pip. If your development environment
90
92
does not already have pip, use the software package manager of your platform (e.g. apt-get, brew)
@@ -120,7 +122,7 @@ pass `all` as an argument.
120
122
121
123
```
122
124
./lint.sh # Lint locally modified source files
123
- ./lint.sh all # Lint all source files
125
+ ./lint.sh all # Lint all source files
124
126
```
125
127
126
128
Ideally you should not see any pylint errors or warnings when you run the
@@ -167,36 +169,52 @@ do not already have one suitable for running the tests aginst. Then obtain the
167
169
following credentials from the project:
168
170
169
171
1 . * Service account certificate* : This can be downloaded as a JSON file from
170
- the "Settings > Service Accounts" tab of the Firebase console.
172
+ the "Settings > Service Accounts" tab of the Firebase console. Copy the
173
+ file into the repo so it's available at ` scripts/cert.json ` .
171
174
2 . * Web API key* : This is displayed in the "Settings > General" tab of the
172
- console. Copy it and save to a new text file.
175
+ console. Copy it and save to a new text file at ` scripts/apikey.txt ` .
176
+
177
+ Then set up your Firebase/GCP project as follows:
178
+
179
+ 1 . Enable Firestore: Go to the Firebase Console, and select "Database" from
180
+ the "Develop" menu. Click on the "Create database" button. You may choose
181
+ to set up Firestore either in the locked mode or in the test mode.
182
+ 2 . Enable password auth: Select "Authentication" from the "Develop" menu in
183
+ Firebase Console. Select the "Sign-in method" tab, and enable the
184
+ "Email/Password" sign-in method.
185
+ 3 . Enable the IAM API: Go to the
186
+ [ Google Cloud Platform Console] ( https://console.cloud.google.com ) and make
187
+ sure your Firebase/GCP project is selected. Select "APIs & Services >
188
+ Dashboard" from the main menu, and click the "ENABLE APIS AND SERVICES"
189
+ button. Search for and enable the "Identity and Access Management (IAM)
190
+ API".
173
191
174
192
Now you can invoke the integration test suite as follows:
175
193
176
194
```
177
- pytest integration/ --cert path/to/service_acct .json --apikey path/to /apikey.txt
195
+ pytest integration/ --cert scripts/cert .json --apikey scripts /apikey.txt
178
196
```
179
197
180
198
### Test Coverage
181
199
182
- To review the test coverage, run ` pytest ` with the ` --cov ` flag. To view a detailed line by line
183
- coverage, use
200
+ To review the test coverage, run ` pytest ` with the ` --cov ` flag. To view a detailed line by line
201
+ coverage, use
184
202
``` bash
185
203
pytest --cov --cov-report html
186
204
```
187
- and point your browser to
205
+ and point your browser to
188
206
` file:///<dir>/htmlcov/index.html ` (where ` dir ` is the location from which the report was created).
189
207
190
208
191
209
### Testing in Different Environments
192
210
193
211
Sometimes we want to run unit tests in multiple environments (e.g. different Python versions), and
194
- ensure that the SDK works as expected in each of them. We use
195
- [ tox] ( https://tox.readthedocs.io/en/latest/ ) for this purpose.
212
+ ensure that the SDK works as expected in each of them. We use
213
+ [ tox] ( https://tox.readthedocs.io/en/latest/ ) for this purpose.
196
214
197
215
But before you can invoke tox, you must set up all the necessary target environments on your
198
216
workstation. The easiest and cleanest way to achieve this is by using a tool like
199
- [ pyenv] ( https://github.com/pyenv/pyenv ) . Refer to the
217
+ [ pyenv] ( https://github.com/pyenv/pyenv ) . Refer to the
200
218
[ pyenv documentation] ( https://github.com/pyenv/pyenv#installation ) for instructions on how to
201
219
install it. This generally involves installing some binaries as well as modifying a system level
202
220
configuration file such as ` .bash_profile ` . Once pyenv is installed, you can install multiple
0 commit comments