File tree 1 file changed +15
-5
lines changed
1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -129,17 +129,27 @@ def default(session, path):
129
129
session .install ("." )
130
130
session .install ("-r" , "requirements.txt" )
131
131
# Run pytest with coverage.
132
+ # Using the coverage command instead of `pytest --cov`, because
133
+ # `pytest ---cov` causes the module to be initialized twice, which returns
134
+ # this error: "ImportError: PyO3 modules compiled for CPython 3.8 or older
135
+ # may only be initialized once per interpreter process". More info about
136
+ # this is stated here: https://github.com/pytest-dev/pytest-cov/issues/614.
132
137
session .run (
138
+ "coverage" ,
139
+ "run" ,
140
+ "--include=*/google/cloud/alloydb/connector/*.py" ,
141
+ "-m" ,
133
142
"pytest" ,
134
- "--cov=google.cloud.alloydb.connector" ,
135
143
"-v" ,
136
- "--cov-config=.coveragerc" ,
137
- "--cov-report=" ,
138
- "--cov-fail-under=0" ,
139
- "--junitxml=sponge_log.xml" ,
140
144
path ,
141
145
* session .posargs ,
142
146
)
147
+ session .run (
148
+ "coverage" ,
149
+ "xml" ,
150
+ "-o" ,
151
+ "sponge_log.xml" ,
152
+ )
143
153
144
154
145
155
@nox .session (python = UNIT_TEST_PYTHON_VERSIONS )
You can’t perform that action at this time.
0 commit comments