19
19
import nox # pytype: disable=import-error
20
20
21
21
22
- @nox .session
23
22
def default (session ):
24
23
"""Default unit test session.
25
24
@@ -52,57 +51,37 @@ def default(session):
52
51
)
53
52
54
53
55
- @nox .session
56
- @nox .parametrize ('py' , ['2.7' , '3.5' , '3.6' , '3.7' ])
57
- def unit (session , py ):
54
+ @nox .session (python = ['2.7' , '3.5' , '3.6' , '3.7' ])
55
+ def unit (session ):
58
56
"""Run the unit test suite."""
59
-
60
- # Run unit tests against all supported versions of Python.
61
- session .interpreter = 'python{}' .format (py )
62
-
63
- # Set the virtualenv dirname.
64
- session .virtualenv_dirname = 'unit-' + py
65
-
66
57
default (session )
67
58
68
59
69
- @nox .session
70
- @nox .parametrize ('py' , ['2.7' , '3.5' , '3.6' , '3.7' ])
71
- def unit_grpc_gcp (session , py ):
60
+ @nox .session (python = ['2.7' , '3.5' , '3.6' , '3.7' ])
61
+ def unit_grpc_gcp (session ):
72
62
"""Run the unit test suite with grpcio-gcp installed."""
73
63
74
- # Run unit tests against all supported versions of Python.
75
- session .interpreter = 'python{}' .format (py )
76
-
77
- # Set the virtualenv dirname.
78
- session .virtualenv_dirname = 'unit-grpc-gcp-' + py
79
-
80
64
# Install grpcio-gcp
81
65
session .install ('grpcio-gcp' )
82
66
83
67
default (session )
84
68
85
69
86
- @nox .session
70
+ @nox .session ( python = '3.6' )
87
71
def lint (session ):
88
72
"""Run linters.
89
73
90
74
Returns a failure if the linters find linting errors or sufficiently
91
75
serious code quality issues.
92
76
"""
93
- session .interpreter = 'python3.6'
94
77
session .install ('flake8' , 'flake8-import-order' )
95
78
session .install ('.' )
96
79
session .run ('flake8' , 'google' , 'tests' )
97
80
98
81
99
- @nox .session
82
+ @nox .session ( python = '3.6' )
100
83
def lint_setup_py (session ):
101
84
"""Verify that setup.py is valid (including RST check)."""
102
- session .interpreter = 'python3.6'
103
-
104
- # Set the virtualenv dirname.
105
- session .virtualenv_dirname = 'setup'
106
85
107
86
session .install ('docutils' , 'Pygments' )
108
87
session .run (
@@ -111,25 +90,23 @@ def lint_setup_py(session):
111
90
112
91
# No 2.7 due to https://github.com/google/importlab/issues/26.
113
92
# No 3.7 because pytype supports up to 3.6 only.
114
- @nox .session
93
+ @nox .session ( python = '3.6' )
115
94
def pytype (session ):
116
95
"""Run type-checking."""
117
- session .interpreter = 'python3.6'
118
96
session .install ('.' ,
119
97
'grpcio >= 1.8.2' ,
120
98
'grpcio-gcp >= 0.2.2' ,
121
99
'pytype >= 2018.9.26' )
122
100
session .run ('pytype' )
123
101
124
102
125
- @nox .session
103
+ @nox .session ( python = '3.6' )
126
104
def cover (session ):
127
105
"""Run the final coverage report.
128
106
129
107
This outputs the coverage report aggregating coverage from the unit
130
108
test runs (not system test runs), and then erases coverage data.
131
109
"""
132
- session .interpreter = 'python3.6'
133
110
session .install ('coverage' , 'pytest-cov' )
134
111
session .run ('coverage' , 'report' , '--show-missing' , '--fail-under=100' )
135
112
session .run ('coverage' , 'erase' )
0 commit comments