Skip to content

Commit c1f0c63

Browse files
yarikopticjreback
authored andcommitted
ENH: fake http proxy in case of --skip-network testing (#19757)
1 parent 966035b commit c1f0c63

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

ci/script_multi.sh

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ if [ -n "$LOCALE_OVERRIDE" ]; then
1212
python -c "$pycmd"
1313
fi
1414

15+
# Enforce absent network during testing by faking a proxy
16+
if echo "$TEST_ARGS" | grep -e --skip-network -q; then
17+
export http_proxy=http://1.2.3.4 https_proxy=http://1.2.3.4;
18+
fi
19+
1520
# Workaround for pytest-xdist flaky collection order
1621
# https://github.com/pytest-dev/pytest/issues/920
1722
# https://github.com/pytest-dev/pytest/issues/1075

ci/script_single.sh

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ if [ "$SLOW" ]; then
1616
TEST_ARGS="--only-slow --skip-network"
1717
fi
1818

19+
# Enforce absent network during testing by faking a proxy
20+
if echo "$TEST_ARGS" | grep -e --skip-network -q; then
21+
export http_proxy=http://1.2.3.4 https_proxy=http://1.2.3.4;
22+
fi
23+
1924
if [ "$PIP_BUILD_TEST" ]; then
2025
echo "We are not running pytest as this is a build test."
2126

pandas/tests/test_downstream.py

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def test_xarray(df):
5353
assert df.to_xarray() is not None
5454

5555

56+
@tm.network
5657
def test_statsmodels():
5758

5859
statsmodels = import_module('statsmodels') # noqa
@@ -73,6 +74,7 @@ def test_scikit_learn(df):
7374
clf.predict(digits.data[-1:])
7475

7576

77+
@tm.network
7678
def test_seaborn():
7779

7880
seaborn = import_module('seaborn')

0 commit comments

Comments
 (0)