Skip to content

Commit

Permalink
SNOW-159814 fix new flake8 3.8.0 issues
Browse files Browse the repository at this point in the history
Description
New flake8 version is able to find new coding issues, fixing these.

Testing
Jenkins tests have passed and Travis should run these as well.
  • Loading branch information
sfc-gh-mkeller authored and sfc-gh-abhatnagar committed May 12, 2020
1 parent 0356e73 commit 153589d
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pandas_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def write_pandas(conn: 'SnowflakeConnection',
'"{stage_name}"'.format(stage_name=stage_name), _is_internal=True).fetchall()
break
except ProgrammingError as pe:
if pe.msg.endswith('already exists.'.format(stage_name)):
if pe.msg.endswith('already exists.'):
continue
raise

Expand Down
8 changes: 3 additions & 5 deletions test/sso/test_unit_sso_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
from snowflake.connector.auth import delete_temporary_credential
from snowflake.connector.compat import IS_MACOS

@patch(
'snowflake.connector.auth_webbrowser.AuthByWebBrowser.authenticate')
@patch(
'snowflake.connector.network.SnowflakeRestful._post_request'
)

@patch('snowflake.connector.auth_webbrowser.AuthByWebBrowser.authenticate')
@patch('snowflake.connector.network.SnowflakeRestful._post_request')
def test_connect_externalbrowser(
mockSnowflakeRestfulPostRequest,
mockAuthByBrowserAuthenticate):
Expand Down
2 changes: 1 addition & 1 deletion test/test_boolean.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_binding_fetching_boolean(conn_cnx, db_parameters):
# SNOW-15905: boolean support
results = cnx.cursor().execute("""
SELECT CASE WHEN (null LIKE trim(null)) THEN null ELSE null END
""".format(name=db_parameters['name'])).fetchall()
""").fetchall()
assert not results[0][0]

finally:
Expand Down
1 change: 0 additions & 1 deletion test/test_load_unload.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ def test_put_local_file(conn_cnx, test_data):
AWS_SECRET_KEY={aws_secret_access_key}))
""".format(aws_access_key_id=test_data.AWS_ACCESS_KEY_ID,
aws_secret_access_key=test_data.AWS_SECRET_ACCESS_KEY,
database=test_data.database_name,
stage_name=test_data.stage_name, ))
cur.execute("""
put file://{}/ExecPlatform/Database/data/orders_10*.csv @%pytest_putget_t1
Expand Down
2 changes: 1 addition & 1 deletion test/test_put_get_medium.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ def _generate_huge_value_json(tmpdir, n=1, value_size=1):
f = gzip.open(fname, 'wb')
for i in range(n):
logger.debug("adding a value in {}".format(i))
f.write('{"k":"{0}"}'.format(
f.write('{{"k":"{}"}}'.format(
''.join(
random.choice(string.ascii_uppercase + string.digits) for _ in
range(value_size))))
Expand Down
2 changes: 1 addition & 1 deletion test/test_put_get_user_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def _put_list_rm_files_in_stage(tmpdir, conn_cnx, db_parameters, elem):
assert rec[6] == 'UPLOADED'
rec = cnx.cursor().execute("""
LIST @{stage_name}
""".format(stage_name=stage_name, output_dir=output_dir)).fetchone()
""".format(stage_name=stage_name)).fetchone()
assert rec, 'LIST should return something'
assert rec[0].startswith('s3://'), "The file location in S3"
rec = cnx.cursor().execute("""
Expand Down
2 changes: 1 addition & 1 deletion test/test_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def fin():
assert ret[0] == 21
cnx.cursor().execute("""
SELECT WRONG SYNTAX QUERY
""".format(name=db_parameters['name']))
""")
raise Exception("Failed to cause the syntax error")
except snowflake.connector.Error:
# syntax error should be caught here
Expand Down

0 comments on commit 153589d

Please sign in to comment.