Skip to content

Commit 5984b64

Browse files
partheaohmayr
andauthored
build: treat warnings as errors (#156)
Co-authored-by: ohmayr <omairnaveed@ymail.com>
1 parent 0f3d8c1 commit 5984b64

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[pytest]
2+
filterwarnings =
3+
# treat all warnings as errors
4+
error

packages/google-cloud-testutils/tests/unit/test_orchestrate.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,11 @@ def run_in_test_thread():
282282

283283

284284
def test__get_syncpoints(): # pragma: SYNCPOINT test_get_syncpoints
285-
lines = enumerate(open(__file__, "r"), start=1)
286-
for expected_lineno, line in lines: # pragma: NO BRANCH COVER
287-
if "# pragma: SYNCPOINT test_get_syncpoints" in line:
288-
break
285+
with open(__file__, "r") as file:
286+
lines = enumerate(file, start=1)
287+
for expected_lineno, line in lines: # pragma: NO BRANCH COVER
288+
if "# pragma: SYNCPOINT test_get_syncpoints" in line:
289+
break
289290

290291
orchestrate._get_syncpoints(__file__)
291292
syncpoints = orchestrate._SYNCPOINTS[__file__]["test_get_syncpoints"]
@@ -327,10 +328,11 @@ def test__trace_this_source_file():
327328

328329
@staticmethod
329330
def test__trace_reach_syncpoint():
330-
lines = enumerate(open(__file__, "r"), start=1)
331-
for syncpoint_lineno, line in lines: # pragma: NO BRANCH COVER
332-
if "# pragma: SYNCPOINT test_get_syncpoints" in line:
333-
break
331+
with open(__file__, "r") as file:
332+
lines = enumerate(file, start=1)
333+
for syncpoint_lineno, line in lines: # pragma: NO BRANCH COVER
334+
if "# pragma: SYNCPOINT test_get_syncpoints" in line:
335+
break
334336

335337
orchestrate._SYNCPOINTS.clear()
336338
frame = mock.Mock(

0 commit comments

Comments
 (0)