Skip to content

Commit

Permalink
Use Python3.7+ syntax in pyupgrade (#20501)
Browse files Browse the repository at this point in the history
* Use Python3.7+ syntax in pyupgrade

* Update test_dataflow.py

* Update test_dataflow.py

* Update test_dataflow.py
  • Loading branch information
mik-laj committed Dec 28, 2021
1 parent 3b709cc commit b7086f9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ repos:
files: ^chart/values\.schema\.json$|^chart/values_schema\.schema\.json$
pass_filenames: true
- repo: https://github.com/asottile/pyupgrade
rev: v2.29.0
rev: v2.29.1
hooks:
- id: pyupgrade
args: ["--py36-plus"]
args: ["--py37-plus"]
exclude: ^airflow/_vendor/
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
Expand Down
2 changes: 1 addition & 1 deletion airflow/providers/google/cloud/hooks/dataflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ def start_sql_job(
]
self.log.info("Executing command: %s", " ".join(shlex.quote(c) for c in cmd))
with self.provide_authorized_gcloud():
proc = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
proc = subprocess.run(cmd, capture_output=True)
self.log.info("Output: %s", proc.stdout.decode())
self.log.warning("Stderr: %s", proc.stderr.decode())
self.log.info("Exit code %d", proc.returncode)
Expand Down
4 changes: 1 addition & 3 deletions tests/providers/google/cloud/hooks/test_dataflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import copy
import shlex
import subprocess
import unittest
from typing import Any, Dict
from unittest import mock
Expand Down Expand Up @@ -1108,8 +1107,7 @@ def test_start_sql_job_failed_to_run(
'--bigquery-table=beam_output',
'--bigquery-write-disposition=write-truncate',
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
capture_output=True,
)
mock_controller.assert_called_once_with(
dataflow=mock_get_conn.return_value,
Expand Down

0 comments on commit b7086f9

Please sign in to comment.