Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Stage 5 of nox implementation - adding coverage targets #479

Merged
merged 4 commits into from Aug 31, 2020

Conversation

mf2199
Copy link
Contributor

@mf2199 mf2199 commented Aug 31, 2020

As suggested in #466 , this represents item 5 of the recommended list aimed to implement nox testing automation in multiple steps.

Change list:

  1. Added cover session to noxfile.py + configuration parameters;

The code, at it current state, shows only 41% test coverage:

nox > Running session cover
nox > Creating virtual environment (virtualenv) using python.exe in .nox\cover
nox > pip install coverage pytest-cov
nox > coverage report --show-missing --fail-under=99
Name                                      Stmts   Miss Branch BrPart  Cover   Missing
-------------------------------------------------------------------------------------
django_spanner\__init__.py                   41     41     12      0     0%   7-73
django_spanner\base.py                       49     49      2      0     0%   7-146
django_spanner\client.py                      3      3      0      0     0%   7-11
django_spanner\compiler.py                   48     48     28      0     0%   7-90
django_spanner\creation.py                   46     46     14      0     0%   7-75
django_spanner\expressions.py                10     10      4      0     0%   7-22
django_spanner\features.py                   27     27      4      0     0%   7-342
django_spanner\functions.py                  52     52      4      0     0%   7-104
django_spanner\introspection.py              65     65     28      0     0%   7-217
django_spanner\lookups.py                    90     90     36      0     0%   7-144
django_spanner\operations.py                158    158     68      0     0%   7-275
django_spanner\schema.py                    127    127     72      0     0%   7-262
django_spanner\utils.py                       7      7      2      0     0%   1-14
django_spanner\validation.py                 10     10      2      0     0%   1-21
spanner_dbapi\__init__.py                    20      2      4      2    83%   85->86, 86, 89->90, 90
spanner_dbapi\connection.py                  62     37      6      0    37%   24-26, 32-33, 44-46, 49-50, 53-54, 57-58, 61-69, 72, 84-88, 91-110, 113-115, 118-120, 123, 128, 131-132
spanner_dbapi\cursor.py                     173    130     54      0    19%   43-52, 64-93, 96, 102-110, 113-139, 145-151, 155-158, 161-184, 187, 190, 193, 197-213, 217, 223-224, 227-228, 231-235, 238-240, 243-245, 248-253, 256-258,
 273-285, 289, 292, 295, 298, 301, 304, 307, 313-319, 325-338, 341-351
spanner_dbapi\exceptions.py                  20      0      0      0   100%
spanner_dbapi\parse_utils.py                156      8     89      8    93%   39->40, 40, 43->49, 49, 141->142, 142, 156->157, 157, 249->250, 250, 273->274, 274, 321->322, 322, 338->339, 339
spanner_dbapi\parser.py                     142     18     78     10    85%   49->50, 50, 51->52, 52, 53->54, 54, 55->56, 56, 81, 87->88, 88, 91->92, 92, 96->97, 97, 115->119, 119, 126->127, 127, 139, 196->233, 233-242, 246-247
spanner_dbapi\types.py                       31      1      0      0    97%   43
spanner_dbapi\utils.py                       39      0     10      0   100%
spanner_dbapi\version.py                      7      0      0      0   100%
tests\spanner_dbapi\__init__.py               0      0      0      0   100%
tests\spanner_dbapi\test_connect.py          46      6      0      0    87%   57, 70, 80-82, 95-97
tests\spanner_dbapi\test_globals.py           7      0      0      0   100%
tests\spanner_dbapi\test_parse_utils.py      74      0     26      0   100%
tests\spanner_dbapi\test_parser.py           52      0     24      0   100%
tests\spanner_dbapi\test_types.py            43      0      2      0   100%
tests\spanner_dbapi\test_utils.py            19      0      0      0   100%
tests\spanner_dbapi\test_version.py          14      0      0      0   100%
-------------------------------------------------------------------------------------
TOTAL                                      1638    935    569     20    41%
Coverage failure: total of 41 is less than fail-under=99
nox > Command coverage report --show-missing --fail-under=99 failed with exit code 2
nox > Session cover failed.

Towards #474.

@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Aug 31, 2020
@mf2199 mf2199 added api: spanner Issues related to the googleapis/python-spanner-django API. type: process A process-related concern. May include testing, release, or the like. labels Aug 31, 2020
@mf2199 mf2199 requested review from c24t and IlyaFaer August 31, 2020 18:33
Copy link
Contributor

@c24t c24t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The coverage target itself looks good, but some questions about the config:

Bacause of .coveragerc, running coverage alone fails under 100, but running nox -e coverage fails under 99, and running nox generates a coverage report but never fails. Why the three different limits? And what's the point of generating the coverage report on each build if we never fail because of coverage?

I see this is how python-spanner does it too (https://github.com/googleapis/python-spanner/blob/master/noxfile.py, https://github.com/googleapis/python-spanner/blob/master/.coveragerc), I just don't understand why they're doing it this way.

@mf2199
Copy link
Contributor Author

mf2199 commented Aug 31, 2020

I see this is how python-spanner does it too (https://github.com/googleapis/python-spanner/blob/master/noxfile.py, https://github.com/googleapis/python-spanner/blob/master/.coveragerc), I just don't understand why they're doing it this way.

This is a common way among other API as well, e.g. Storage, Firestore, Bigtable etc.

@mf2199 mf2199 marked this pull request as ready for review August 31, 2020 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/python-spanner-django API. cla: yes This human has signed the Contributor License Agreement. type: process A process-related concern. May include testing, release, or the like.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants