Skip to content

Commit c753e1e

Browse files
jorisvandenbosschejreback
authored andcommitted
TST: make it possible to run tests without moto installed (#18719)
1 parent 5d9151c commit c753e1e

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

pandas/tests/io/conftest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os
22

3-
import moto
43
import pytest
54
from pandas.io.parsers import read_table
65

@@ -42,6 +41,7 @@ def s3_resource(tips_file, jsonl_file):
4241
is yielded by the fixture.
4342
"""
4443
pytest.importorskip('s3fs')
44+
moto = pytest.importorskip('moto')
4545
moto.mock_s3().start()
4646

4747
test_s3_files = [

pandas/tests/io/json/test_compression.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import pytest
2-
import moto
32

43
import pandas as pd
54
from pandas import compat
@@ -73,6 +72,8 @@ def test_read_zipped_json():
7372
def test_with_s3_url(compression):
7473
boto3 = pytest.importorskip('boto3')
7574
pytest.importorskip('s3fs')
75+
moto = pytest.importorskip('moto')
76+
7677
if compression == 'xz':
7778
tm._skip_if_no_lzma()
7879

pandas/tests/io/test_excel.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import numpy as np
1111
import pytest
1212
from numpy import nan
13-
import moto
1413

1514
import pandas as pd
1615
import pandas.util.testing as tm
@@ -616,6 +615,7 @@ def test_read_from_http_url(self):
616615
def test_read_from_s3_url(self):
617616
boto3 = pytest.importorskip('boto3')
618617
pytest.importorskip('s3fs')
618+
moto = pytest.importorskip('moto')
619619

620620
with moto.mock_s3():
621621
conn = boto3.resource("s3", region_name="us-east-1")

0 commit comments

Comments
 (0)