@@ -2082,11 +2082,10 @@ def test_schema(tmpdir, options, expected):
20822082def test_long_csv_column_value (tmpdir ):
20832083 db_path = str (tmpdir / "test.db" )
20842084 csv_path = str (tmpdir / "test.csv" )
2085- csv_file = open (csv_path , "w" )
2086- long_string = "a" * 131073
2087- csv_file .write ("id,text\n " )
2088- csv_file .write ("1,{}\n " .format (long_string ))
2089- csv_file .close ()
2085+ with open (csv_path , "w" ) as csv_file :
2086+ long_string = "a" * 131073
2087+ csv_file .write ("id,text\n " )
2088+ csv_file .write ("1,{}\n " .format (long_string ))
20902089 result = CliRunner ().invoke (
20912090 cli .cli ,
20922091 ["insert" , db_path , "bigtable" , csv_path , "--csv" ],
@@ -2110,11 +2109,10 @@ def test_long_csv_column_value(tmpdir):
21102109def test_import_no_headers (tmpdir , args , tsv ):
21112110 db_path = str (tmpdir / "test.db" )
21122111 csv_path = str (tmpdir / "test.csv" )
2113- csv_file = open (csv_path , "w" )
2114- sep = "\t " if tsv else ","
2115- csv_file .write ("Cleo{sep}Dog{sep}5\n " .format (sep = sep ))
2116- csv_file .write ("Tracy{sep}Spider{sep}7\n " .format (sep = sep ))
2117- csv_file .close ()
2112+ with open (csv_path , "w" ) as csv_file :
2113+ sep = "\t " if tsv else ","
2114+ csv_file .write ("Cleo{sep}Dog{sep}5\n " .format (sep = sep ))
2115+ csv_file .write ("Tracy{sep}Spider{sep}7\n " .format (sep = sep ))
21182116 result = CliRunner ().invoke (
21192117 cli .cli ,
21202118 ["insert" , db_path , "creatures" , csv_path ] + args ,
0 commit comments