Skip to content

Commit fd4bc76

Browse files
jrebackjorisvandenbossche
authored andcommitted
TST: use a fixed seed to have the same uniques across python versions (#25346)
TST: add pytest-mock to handle mocker fixture (cherry picked from commit 4a20d5b)
1 parent 0fa9580 commit fd4bc76

15 files changed

+21
-5
lines changed

ci/deps/azure-27-compat.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ dependencies:
2020
# universal
2121
- pytest
2222
- pytest-xdist
23+
- pytest-mock
2324
- pip:
2425
- html5lib==1.0b2
2526
- beautifulsoup4==4.2.1

ci/deps/azure-27-locale.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ dependencies:
2222
# universal
2323
- pytest
2424
- pytest-xdist
25+
- pytest-mock
2526
- hypothesis>=3.58.0
2627
- pip:
2728
- html5lib==1.0b2

ci/deps/azure-36-locale_slow.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ dependencies:
2828
# universal
2929
- pytest
3030
- pytest-xdist
31+
- pytest-mock
3132
- moto
3233
- pip:
3334
- hypothesis>=3.58.0

ci/deps/azure-37-locale.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ dependencies:
2727
# universal
2828
- pytest
2929
- pytest-xdist
30+
- pytest-mock
3031
- pip:
3132
- hypothesis>=3.58.0
3233
- moto # latest moto in conda-forge fails with 3.7, move to conda dependencies when this is fixed

ci/deps/azure-37-numpydev.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ dependencies:
88
# universal
99
- pytest
1010
- pytest-xdist
11+
- pytest-mock
1112
- hypothesis>=3.58.0
1213
- pip:
1314
- "git+git://github.com/dateutil/dateutil.git"

ci/deps/azure-macos-35.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ dependencies:
2424
# universal
2525
- pytest
2626
- pytest-xdist
27+
- pytest-mock
2728
- pip:
2829
- python-dateutil==2.5.3
2930
- hypothesis>=3.58.0

ci/deps/azure-windows-27.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ dependencies:
2727
- cython>=0.28.2
2828
- pytest
2929
- pytest-xdist
30+
- pytest-mock
3031
- moto
3132
- hypothesis>=3.58.0

ci/deps/azure-windows-36.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ dependencies:
2525
- cython>=0.28.2
2626
- pytest
2727
- pytest-xdist
28+
- pytest-mock
2829
- hypothesis>=3.58.0

ci/deps/travis-27.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ dependencies:
4141
# universal
4242
- pytest
4343
- pytest-xdist
44+
- pytest-mock
4445
- moto==1.3.4
4546
- hypothesis>=3.58.0
4647
- pip:

ci/deps/travis-36-locale.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ dependencies:
3030
# universal
3131
- pytest
3232
- pytest-xdist
33+
- pytest-mock
3334
- moto
3435
- pip:
3536
- hypothesis>=3.58.0

ci/deps/travis-36-slow.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ dependencies:
2727
# universal
2828
- pytest
2929
- pytest-xdist
30+
- pytest-mock
3031
- moto
3132
- hypothesis>=3.58.0

ci/deps/travis-36.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ dependencies:
3636
- pytest
3737
- pytest-xdist
3838
- pytest-cov
39+
- pytest-mock
3940
- hypothesis>=3.58.0
4041
- pip:
4142
- brotlipy

ci/deps/travis-37.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ dependencies:
1414
- pytz
1515
- pytest
1616
- pytest-xdist
17+
- pytest-mock
1718
- hypothesis>=3.58.0
1819
- s3fs
1920
- pip:

pandas/tests/io/formats/test_console.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,12 @@ def test_detect_console_encoding_fallback_to_default(monkeypatch, std, locale):
7878

7979

8080
@pytest.mark.parametrize("size", ['', ['']])
81-
def test_terminal_unknown_dimensions(monkeypatch, size):
82-
mock = pytest.importorskip("unittest.mock")
81+
def test_terminal_unknown_dimensions(monkeypatch, size, mocker):
8382

8483
def communicate(*args, **kwargs):
8584
return size
8685

87-
monkeypatch.setattr('subprocess.Popen', mock.Mock())
86+
monkeypatch.setattr('subprocess.Popen', mocker.Mock())
8887
monkeypatch.setattr('subprocess.Popen.return_value.returncode', None)
8988
monkeypatch.setattr(
9089
'subprocess.Popen.return_value.communicate', communicate)

pandas/tests/resample/test_datetime_index.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1209,9 +1209,13 @@ def test_resample_nunique_with_date_gap():
12091209
@pytest.mark.parametrize('k', [10, 100, 1000])
12101210
def test_resample_group_info(n, k):
12111211
# GH10914
1212+
1213+
# use a fixed seed to always have the same uniques
1214+
prng = np.random.RandomState(1234)
1215+
12121216
dr = date_range(start='2015-08-27', periods=n // 10, freq='T')
1213-
ts = Series(np.random.randint(0, n // k, n).astype('int64'),
1214-
index=np.random.choice(dr, n))
1217+
ts = Series(prng.randint(0, n // k, n).astype('int64'),
1218+
index=prng.choice(dr, n))
12151219

12161220
left = ts.resample('30T').nunique()
12171221
ix = date_range(start=ts.index.min(), end=ts.index.max(),

0 commit comments

Comments
 (0)