Skip to content

Commit

Permalink
chore(tests): use 'urllib.request' instead of 'requests'
Browse files Browse the repository at this point in the history
  • Loading branch information
stormbeforesunsetbee committed Nov 29, 2022
1 parent 18e20d3 commit 9252208
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
1 change: 0 additions & 1 deletion examples/meteorites/meteorites.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
"\n",
"import numpy as np\n",
"import pandas as pd\n",
"import requests\n",
"\n",
"import pandas_profiling\n",
"from pandas_profiling.utils.cache import cache_file"
Expand Down
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ numpy>=1.16.0,<1.24
htmlmin==0.1.12
# Correlations
phik>=0.11.1,<0.13
# Examples
requests>=2.24.0, <2.29
# Progress bar
tqdm>=4.48.2, <4.65
seaborn>=0.10.1, <0.13
Expand Down
4 changes: 2 additions & 2 deletions tests/issues/test_issue377.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import pandas as pd
import pytest
import requests
from urllib.error import URLError, HTTPError

from pandas_profiling import ProfileReport
from pandas_profiling.utils.cache import cache_zipped_file
Expand All @@ -19,7 +19,7 @@ def df():
"bank-full.csv",
"https://archive.ics.uci.edu/ml/machine-learning-databases/00222/bank.zip",
)
except (requests.exceptions.ConnectionError, FileNotFoundError):
except (URLError, HTTPError):
return

# Download the UCI Bank Marketing Dataset
Expand Down
10 changes: 6 additions & 4 deletions tests/issues/test_issue537.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import numpy as np
import pandas as pd
import requests
from urllib import request

from pandas_profiling.model.summary import describe_1d

Expand Down Expand Up @@ -56,9 +56,11 @@ def test_multiprocessing_describe1d(config, summarizer, typeset):
"""

def download_and_process_data():
response = requests.get("https://ndownloader.figshare.com/files/5976042")
assert response.status_code == 200
file = decompress(response.content)
response = request.urlopen("https://ndownloader.figshare.com/files/5976042")
# TODO: 'urllib.response.addinfourl.code' is deprecated since Python 3.9,
# use 'urllib.response.addinfourl.status' instead on next dependency bump
assert response.code == 200
file = decompress(response.read())
text = file.decode()
split_text = [i.split(",") for i in filter(lambda x: x, text.split("\n"))]
dt = [
Expand Down
1 change: 0 additions & 1 deletion tests/notebooks/meteorites.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"\n",
"import numpy as np\n",
"import pandas as pd\n",
"import requests\n",
"from IPython.display import display\n",
"from IPython.utils.capture import capture_output\n",
"\n",
Expand Down

0 comments on commit 9252208

Please sign in to comment.