@@ -134,6 +134,12 @@ pytest
134134Refer to the pytest [ usage and invocations guide] ( http://doc.pytest.org/en/latest/usage.html )
135135to learn how to run a subset of all test cases.
136136
137+ You can also get a code coverage report by launching pytest as follows:
138+
139+ ```
140+ pytest --cov=firebase_admin --cov=tests
141+ ```
142+
137143### Testing in Different Environments
138144
139145Sometimes we want to run unit tests in multiple environments (e.g. different Python versions), and
@@ -149,20 +155,40 @@ configuration file such as `.bash_profile`. Once pyenv is installed, you can ins
149155versions of Python as follows:
150156
151157```
152- pyenv install 2.7.6 # install Python 2.7.6
153- pyenv install 3.3.0 # install Python 3.3.0
158+ pyenv install 2.7.6 # install Python 2.7.6
159+ pyenv install 3.3.0 # install Python 3.3.0
160+ pyenv install pypy2-5.6.0 # install pypy2
154161```
155162
156163Refer to the [ ` tox.ini ` ] ( ../tox.ini ) file for a list of target environments that we usually test.
157- Use pyenv to install all the required Python versions on your workstation. When your system is
158- fully set up, you can execute the following command from the root of the repository to launch tox:
164+ Use pyenv to install all the required Python versions on your workstation. Verify that they are
165+ installed by running the following command:
166+
167+ ```
168+ pyenv versions
169+ ```
170+
171+ To make all the required Python versions available to tox for testing, run the ` pyenv local ` command
172+ with all the Python versions as arguments. The following example shows how to make Python versions
173+ 2.7.6, 3.3.0 and pypy2 available to tox.
174+
175+ ```
176+ pyenv local 2.7.6 3.3.0 pypy2-5.6.0
177+ ```
178+
179+ Once your system is fully set up, you can execute the following command from the root of the
180+ repository to launch tox:
159181
160182```
161183tox
162184```
163185
164186This command will read the list of target environments from ` tox.ini ` , and execute tests in each of
165- those environments.
187+ those environments. It will also generate a code coverage report at the end of the execution.
188+
189+ ```
190+ pyenv local 2.7.6 3.3.0 pypy2-5.6.0
191+ ```
166192
167193### Repo Organization
168194
0 commit comments