diff --git a/pandas/io/tests/test_sql.py b/pandas/io/tests/test_sql.py index a34f278fc5a96..68de031641c58 100644 --- a/pandas/io/tests/test_sql.py +++ b/pandas/io/tests/test_sql.py @@ -157,12 +157,13 @@ def _get_exec(self): return self.conn.cursor() def _load_iris_data(self): + import io iris_csv_file = os.path.join(tm.get_data_path(), 'iris.csv') self.drop_table('iris') self._get_exec().execute(SQL_STRINGS['create_iris'][self.flavor]) - with open(iris_csv_file, 'rU') as iris_csv: + with io.open(iris_csv_file, mode='r', newline=None) as iris_csv: r = csv.reader(iris_csv) next(r) # skip header row ins = SQL_STRINGS['insert_iris'][self.flavor] diff --git a/pandas/tests/test_series.py b/pandas/tests/test_series.py index 093954f1d8c1d..08aed66432385 100644 --- a/pandas/tests/test_series.py +++ b/pandas/tests/test_series.py @@ -4235,11 +4235,12 @@ def test_from_csv(self): assert_series_equal(checkseries, series) def test_to_csv(self): + import io with ensure_clean() as path: self.ts.to_csv(path) - lines = open(path, 'U').readlines() + lines = io.open(path, newline=None).readlines() assert(lines[1] != '\n') self.ts.to_csv(path, index=False)