Skip to content

Commit b7086f9

Browse files
authored
Use Python3.7+ syntax in pyupgrade (#20501)
* Use Python3.7+ syntax in pyupgrade * Update test_dataflow.py * Update test_dataflow.py * Update test_dataflow.py
1 parent 3b709cc commit b7086f9

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

β€Ž.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,10 @@ repos:
196196
files: ^chart/values\.schema\.json$|^chart/values_schema\.schema\.json$
197197
pass_filenames: true
198198
- repo: https://github.com/asottile/pyupgrade
199-
rev: v2.29.0
199+
rev: v2.29.1
200200
hooks:
201201
- id: pyupgrade
202-
args: ["--py36-plus"]
202+
args: ["--py37-plus"]
203203
exclude: ^airflow/_vendor/
204204
- repo: https://github.com/pre-commit/pygrep-hooks
205205
rev: v1.9.0

β€Žairflow/providers/google/cloud/hooks/dataflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ def start_sql_job(
10351035
]
10361036
self.log.info("Executing command: %s", " ".join(shlex.quote(c) for c in cmd))
10371037
with self.provide_authorized_gcloud():
1038-
proc = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
1038+
proc = subprocess.run(cmd, capture_output=True)
10391039
self.log.info("Output: %s", proc.stdout.decode())
10401040
self.log.warning("Stderr: %s", proc.stderr.decode())
10411041
self.log.info("Exit code %d", proc.returncode)

β€Žtests/providers/google/cloud/hooks/test_dataflow.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import copy
2121
import shlex
22-
import subprocess
2322
import unittest
2423
from typing import Any, Dict
2524
from unittest import mock
@@ -1108,8 +1107,7 @@ def test_start_sql_job_failed_to_run(
11081107
'--bigquery-table=beam_output',
11091108
'--bigquery-write-disposition=write-truncate',
11101109
],
1111-
stdout=subprocess.PIPE,
1112-
stderr=subprocess.PIPE,
1110+
capture_output=True,
11131111
)
11141112
mock_controller.assert_called_once_with(
11151113
dataflow=mock_get_conn.return_value,

0 commit comments

Comments
 (0)