Skip to content

TST: use a fixed seed to have the same uniques across python versions #25346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 16, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/deps/azure-27-compat.yaml
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@ dependencies:
# universal
- pytest
- pytest-xdist
- pytest-mock
- pip:
- html5lib==1.0b2
- beautifulsoup4==4.2.1
1 change: 1 addition & 0 deletions ci/deps/azure-27-locale.yaml
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ dependencies:
# universal
- pytest
- pytest-xdist
- pytest-mock
- hypothesis>=3.58.0
- pip:
- html5lib==1.0b2
1 change: 1 addition & 0 deletions ci/deps/azure-36-locale_slow.yaml
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ dependencies:
# universal
- pytest
- pytest-xdist
- pytest-mock
- moto
- pip:
- hypothesis>=3.58.0
1 change: 1 addition & 0 deletions ci/deps/azure-37-locale.yaml
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@ dependencies:
# universal
- pytest
- pytest-xdist
- pytest-mock
- pip:
- hypothesis>=3.58.0
- moto # latest moto in conda-forge fails with 3.7, move to conda dependencies when this is fixed
1 change: 1 addition & 0 deletions ci/deps/azure-37-numpydev.yaml
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ dependencies:
# universal
- pytest
- pytest-xdist
- pytest-mock
- hypothesis>=3.58.0
- pip:
- "git+git://github.com/dateutil/dateutil.git"
1 change: 1 addition & 0 deletions ci/deps/azure-macos-35.yaml
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ dependencies:
# universal
- pytest
- pytest-xdist
- pytest-mock
- pip:
- python-dateutil==2.5.3
- hypothesis>=3.58.0
1 change: 1 addition & 0 deletions ci/deps/azure-windows-27.yaml
Original file line number Diff line number Diff line change
@@ -27,5 +27,6 @@ dependencies:
- cython>=0.28.2
- pytest
- pytest-xdist
- pytest-mock
- moto
- hypothesis>=3.58.0
1 change: 1 addition & 0 deletions ci/deps/azure-windows-36.yaml
Original file line number Diff line number Diff line change
@@ -25,4 +25,5 @@ dependencies:
- cython>=0.28.2
- pytest
- pytest-xdist
- pytest-mock
- hypothesis>=3.58.0
1 change: 1 addition & 0 deletions ci/deps/travis-27.yaml
Original file line number Diff line number Diff line change
@@ -41,6 +41,7 @@ dependencies:
# universal
- pytest
- pytest-xdist
- pytest-mock
- moto==1.3.4
- hypothesis>=3.58.0
- pip:
1 change: 1 addition & 0 deletions ci/deps/travis-36-locale.yaml
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@ dependencies:
# universal
- pytest
- pytest-xdist
- pytest-mock
- moto
- pip:
- hypothesis>=3.58.0
1 change: 1 addition & 0 deletions ci/deps/travis-36-slow.yaml
Original file line number Diff line number Diff line change
@@ -27,5 +27,6 @@ dependencies:
# universal
- pytest
- pytest-xdist
- pytest-mock
- moto
- hypothesis>=3.58.0
1 change: 1 addition & 0 deletions ci/deps/travis-36.yaml
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@ dependencies:
- pytest
- pytest-xdist
- pytest-cov
- pytest-mock
- hypothesis>=3.58.0
- pip:
- brotlipy
1 change: 1 addition & 0 deletions ci/deps/travis-37.yaml
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ dependencies:
- pytz
- pytest
- pytest-xdist
- pytest-mock
- hypothesis>=3.58.0
- s3fs
- pip:
5 changes: 2 additions & 3 deletions pandas/tests/io/formats/test_console.py
Original file line number Diff line number Diff line change
@@ -78,13 +78,12 @@ def test_detect_console_encoding_fallback_to_default(monkeypatch, std, locale):


@pytest.mark.parametrize("size", ['', ['']])
def test_terminal_unknown_dimensions(monkeypatch, size):
mock = pytest.importorskip("unittest.mock")
def test_terminal_unknown_dimensions(monkeypatch, size, mocker):

def communicate(*args, **kwargs):
return size

monkeypatch.setattr('subprocess.Popen', mock.Mock())
monkeypatch.setattr('subprocess.Popen', mocker.Mock())
monkeypatch.setattr('subprocess.Popen.return_value.returncode', None)
monkeypatch.setattr(
'subprocess.Popen.return_value.communicate', communicate)
8 changes: 6 additions & 2 deletions pandas/tests/resample/test_datetime_index.py
Original file line number Diff line number Diff line change
@@ -1160,9 +1160,13 @@ def test_resample_nunique_with_date_gap():
@pytest.mark.parametrize('k', [10, 100, 1000])
def test_resample_group_info(n, k):
# GH10914

# use a fixed seed to always have the same uniques
prng = np.random.RandomState(1234)

dr = date_range(start='2015-08-27', periods=n // 10, freq='T')
ts = Series(np.random.randint(0, n // k, n).astype('int64'),
index=np.random.choice(dr, n))
ts = Series(prng.randint(0, n // k, n).astype('int64'),
index=prng.choice(dr, n))

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