Skip to content

Commit 98f5faa

Browse files
committed
WIP: Skipping all gzip tests to hunt down ResourceWarning
1 parent 7c577ea commit 98f5faa

File tree

8 files changed

+40
-1
lines changed

8 files changed

+40
-1
lines changed

pandas/tests/io/formats/test_to_csv.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,8 @@ def test_to_csv_compression(self, compression_only,
547547
filename = "test."
548548

549549
if compression == "gzip":
550+
pytest.skip('trying to find unclosed socket causing that is '
551+
'causing a Resourcewarning')
550552
filename += "gz"
551553
else:
552554
# xz --> .xz

pandas/tests/io/json/test_compression.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ def test_to_json_compression(compression_only,
107107
filename = "test."
108108

109109
if compression == "gzip":
110+
pytest.skip('trying to find unclosed socket causing that is '
111+
'causing a Resourcewarning')
110112
filename += "gz"
111113
else:
112114
# xz --> .xz

pandas/tests/io/parser/c_parser_only.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ def test_buffer_rd_bytes(self):
5050
'\x1f\x8b\x08\x00VT\x97V\x00\x03\xed]\xefO'
5151
for i in range(100):
5252
try:
53+
pytest.skip('trying to find unclosed socket causing that is '
54+
'causing a Resourcewarning')
5355
self.read_csv(StringIO(data),
5456
compression='gzip',
5557
delim_whitespace=True)

pandas/tests/io/parser/python_parser_only.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ def test_decompression_regex_sep(self):
145145
expected = self.read_csv(self.csv1)
146146

147147
with tm.ensure_clean() as path:
148+
pytest.skip('trying to find unclosed socket causing that is '
149+
'causing a Resourcewarning')
148150
tmp = gzip.GzipFile(path, mode='wb')
149151
tmp.write(data)
150152
tmp.close()

pandas/tests/io/parser/test_network.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ def tips_df(datapath):
6060
@td.skip_if_not_us_locale()
6161
class TestS3(object):
6262

63+
@pytest.mark.skip('trying to find unclosed socket causing that is '
64+
'causing a Resourcewarning')
6365
def test_parse_public_s3_bucket(self, tips_df):
6466
pytest.importorskip('s3fs')
6567

@@ -78,6 +80,8 @@ def test_parse_public_s3_bucket(self, tips_df):
7880
assert not df.empty
7981
tm.assert_frame_equal(df, tips_df)
8082

83+
@pytest.mark.skip('trying to find unclosed socket causing that is '
84+
'causing a Resourcewarning')
8185
def test_parse_public_s3n_bucket(self, tips_df):
8286

8387
# Read from AWS s3 as "s3n" URL
@@ -86,13 +90,17 @@ def test_parse_public_s3n_bucket(self, tips_df):
8690
assert not df.empty
8791
tm.assert_frame_equal(tips_df.iloc[:10], df)
8892

93+
@pytest.mark.skip('trying to find unclosed socket causing that is '
94+
'causing a Resourcewarning')
8995
def test_parse_public_s3a_bucket(self, tips_df):
9096
# Read from AWS s3 as "s3a" URL
9197
df = read_csv('s3a://pandas-test/tips.csv', nrows=10)
9298
assert isinstance(df, DataFrame)
9399
assert not df.empty
94100
tm.assert_frame_equal(tips_df.iloc[:10], df)
95101

102+
@pytest.mark.skip('trying to find unclosed socket causing that is '
103+
'causing a Resourcewarning')
96104
def test_parse_public_s3_bucket_nrows(self, tips_df):
97105
for ext, comp in [('', None), ('.gz', 'gzip'), ('.bz2', 'bz2')]:
98106
df = read_csv('s3://pandas-test/tips.csv' +
@@ -101,6 +109,8 @@ def test_parse_public_s3_bucket_nrows(self, tips_df):
101109
assert not df.empty
102110
tm.assert_frame_equal(tips_df.iloc[:10], df)
103111

112+
@pytest.mark.skip('trying to find unclosed socket causing that is '
113+
'causing a Resourcewarning')
104114
def test_parse_public_s3_bucket_chunked(self, tips_df):
105115
# Read with a chunksize
106116
chunksize = 5
@@ -118,6 +128,8 @@ def test_parse_public_s3_bucket_chunked(self, tips_df):
118128
chunksize * i_chunk: chunksize * (i_chunk + 1)]
119129
tm.assert_frame_equal(true_df, df)
120130

131+
@pytest.mark.skip('trying to find unclosed socket causing that is '
132+
'causing a Resourcewarning')
121133
def test_parse_public_s3_bucket_chunked_python(self, tips_df):
122134
# Read with a chunksize using the Python parser
123135
chunksize = 5
@@ -135,6 +147,8 @@ def test_parse_public_s3_bucket_chunked_python(self, tips_df):
135147
chunksize * i_chunk: chunksize * (i_chunk + 1)]
136148
tm.assert_frame_equal(true_df, df)
137149

150+
@pytest.mark.skip('trying to find unclosed socket causing that is '
151+
'causing a Resourcewarning')
138152
def test_parse_public_s3_bucket_python(self, tips_df):
139153
for ext, comp in [('', None), ('.gz', 'gzip'), ('.bz2', 'bz2')]:
140154
df = read_csv('s3://pandas-test/tips.csv' + ext, engine='python',
@@ -143,6 +157,8 @@ def test_parse_public_s3_bucket_python(self, tips_df):
143157
assert not df.empty
144158
tm.assert_frame_equal(df, tips_df)
145159

160+
@pytest.mark.skip('trying to find unclosed socket causing that is '
161+
'causing a Resourcewarning')
146162
def test_infer_s3_compression(self, tips_df):
147163
for ext in ['', '.gz', '.bz2']:
148164
df = read_csv('s3://pandas-test/tips.csv' + ext,
@@ -151,6 +167,8 @@ def test_infer_s3_compression(self, tips_df):
151167
assert not df.empty
152168
tm.assert_frame_equal(df, tips_df)
153169

170+
@pytest.mark.skip('trying to find unclosed socket causing that is '
171+
'causing a Resourcewarning')
154172
def test_parse_public_s3_bucket_nrows_python(self, tips_df):
155173
for ext, comp in [('', None), ('.gz', 'gzip'), ('.bz2', 'bz2')]:
156174
df = read_csv('s3://pandas-test/tips.csv' + ext, engine='python',
@@ -159,6 +177,8 @@ def test_parse_public_s3_bucket_nrows_python(self, tips_df):
159177
assert not df.empty
160178
tm.assert_frame_equal(tips_df.iloc[:10], df)
161179

180+
@pytest.mark.skip('trying to find unclosed socket causing that is '
181+
'causing a Resourcewarning')
162182
def test_s3_fails(self):
163183
with pytest.raises(IOError):
164184
read_csv('s3://nyqpug/asdf.csv')
@@ -168,6 +188,8 @@ def test_s3_fails(self):
168188
with pytest.raises(IOError):
169189
read_csv('s3://cant_get_it/')
170190

191+
@pytest.mark.skip('trying to find unclosed socket causing that is '
192+
'causing a Resourcewarning')
171193
def test_read_csv_handles_boto_s3_object(self,
172194
s3_resource,
173195
tips_file):
@@ -184,6 +206,8 @@ def test_read_csv_handles_boto_s3_object(self,
184206
expected = read_csv(tips_file)
185207
tm.assert_frame_equal(result, expected)
186208

209+
@pytest.mark.skip('trying to find unclosed socket causing that is '
210+
'causing a Resourcewarning')
187211
def test_read_csv_chunked_download(self, s3_resource, caplog):
188212
# 8 MB, S3FS usees 5MB chunks
189213
df = DataFrame(np.random.randn(100000, 4), columns=list('abcd'))

pandas/tests/io/parser/test_read_fwf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ def test_fwf_compression(self):
205205
data = bytes(data, encoding='utf-8')
206206
comps = [('gzip', gzip.GzipFile), ('bz2', bz2.BZ2File)]
207207
for comp_name, compresser in comps:
208+
if comp_name == 'gzip':
209+
pytest.skip('trying to find unclosed socket causing that is '
210+
'causing a Resourcewarning')
208211
with tm.ensure_clean() as path:
209212
tmp = compresser(path, mode='wb')
210213
tmp.write(data)

pandas/tests/io/test_parquet.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,11 @@ def test_compression(self, engine, compression):
279279

280280
if compression == 'snappy':
281281
pytest.importorskip('snappy')
282-
283282
elif compression == 'brotli':
284283
pytest.importorskip('brotli')
284+
elif compression == 'gzip':
285+
pytest.skip('trying to find unclosed socket causing that is '
286+
'causing a Resourcewarning')
285287

286288
df = pd.DataFrame({'A': [1, 2, 3]})
287289
check_round_trip(df, engine, write_kwargs={'compression': compression})

pandas/tests/io/test_pickle.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ def compress_file(self, src_path, dest_path, compression):
326326
return
327327

328328
if compression == 'gzip':
329+
pytest.skip('trying to find unclosed socket causing that is '
330+
'causing a Resourcewarning')
329331
import gzip
330332
f = gzip.open(dest_path, "w")
331333
elif compression == 'bz2':

0 commit comments

Comments
 (0)