17
0
Files
python-distributed/importorskip-numpy-tests.patch
Dirk Mueller 4e5755faeb Accepting request 877788 from home:bnavigator:branches:devel:languages:python:numeric
- Update to 2021.3.0
  * This is the first release with support for Python 3.9 and the
    last release with support for Python 3.6
  * tcp.write(): cast memoryview to byte itemsize (#4555)
    Mads R. B. Kristensen
  * Refcount the thread_state.asynchronous flag (#4557) Mads
    R. B. Kristensen
  * Python 3.9 (#4460) crusaderky
  * Better bokeh defaults for dashboard (#4554) Benjamin
    Zaitlen
  * Expose system monitor dashboard as individual plot for lab
    extension (#4540) Jacob Tomlinson
  * Pass on original temp dir from nanny to worker (#4549)
    Martin Durant
  * Serialize and split (#4541) Mads R. B. Kristensen
  * Use the new HLG pack/unpack API in Dask (#4489) Mads R.
    B. Kristensen
  * Handle annotations for culled tasks (#4544) Tom
    Augspurger
  * Make sphinx autosummary and autoclass consistent (#4367)
    Casey Clements
  * Move _transition* to SchedulerState (#4545) jakirkham
  * Migrate from travis to GitHub actions (#4504) crusaderky
  * Move new_task to SchedulerState (#4527) jakirkham
  * Batch more Scheduler sends (#4526) jakirkham
  * transition_memory_released and get_nbytes() optimizations
    (#4516) jakirkham
  * Pin black pre-commit (#4533) James Bourbeau
  * Read & write all frames in one pass (#4506) jakirkham
  * Skip stream.write call for empty frames (#4507) jakirkham
  * Prepend frame metadata header (#4505) jakirkham
  * transition_processing_memory optimizations, etc. (#4487)
    jakirkham
  * Attempt to get client from worker in Queue and Variable
    (#4490) James Bourbeau
  * Use main branch for zict (#4499) jakirkham
  * Use a callback to close TCP Comms, rather than check every
    time (#4453) Matthew Rocklin

OBS-URL: https://build.opensuse.org/request/show/877788
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-distributed?expand=0&rev=90
2021-03-08 22:22:37 +00:00

280 lines
9.2 KiB
Diff

diff --git a/distributed/protocol/tests/test_arrow.py b/distributed/protocol/tests/test_arrow.py
index e86bfa6f..3d2c66af 100644
--- a/distributed/protocol/tests/test_arrow.py
+++ b/distributed/protocol/tests/test_arrow.py
@@ -1,7 +1,7 @@
-import pandas as pd
import pytest
pa = pytest.importorskip("pyarrow")
+pd = pytest.importorskip("pandas")
import distributed
from distributed.utils_test import gen_cluster
diff --git a/distributed/protocol/tests/test_collection.py b/distributed/protocol/tests/test_collection.py
index ddb8a44b..f9f5bf79 100644
--- a/distributed/protocol/tests/test_collection.py
+++ b/distributed/protocol/tests/test_collection.py
@@ -1,8 +1,8 @@
import pytest
from distributed.protocol import serialize, deserialize
-import pandas as pd
-import numpy as np
+np = pytest.importorskip("numpy")
+pd = pytest.importorskip("pandas")
@pytest.mark.parametrize("collection", [tuple, dict, list])
@pytest.mark.parametrize(
diff --git a/distributed/protocol/tests/test_collection_cuda.py b/distributed/protocol/tests/test_collection_cuda.py
index e2602795..19484a87 100644
--- a/distributed/protocol/tests/test_collection_cuda.py
+++ b/distributed/protocol/tests/test_collection_cuda.py
@@ -2,7 +2,6 @@ import pytest
from distributed.protocol import serialize, deserialize
from dask.dataframe.utils import assert_eq
-import pandas as pd
@pytest.mark.parametrize("collection", [tuple, dict])
@@ -37,14 +36,14 @@ def test_serialize_cupy(collection, y, y_serializer):
@pytest.mark.parametrize("collection", [tuple, dict])
@pytest.mark.parametrize(
"df2,df2_serializer",
- [(pd.DataFrame({"C": [3, 4, 5], "D": [2.5, 3.5, 4.5]}), "cuda"), (None, "pickle")],
+ [({"C": [3, 4, 5], "D": [2.5, 3.5, 4.5]}, "cuda"), (None, "pickle")],
)
def test_serialize_pandas_pandas(collection, df2, df2_serializer):
cudf = pytest.importorskip("cudf")
-
+ pd = pytest.importorskip("pandas")
df1 = cudf.DataFrame({"A": [1, 2, None], "B": [1.0, 2.0, None]})
- if df2 is not None:
- df2 = cudf.from_pandas(df2)
+ if df2 is not None:
+ df2 = cudf.from_pandas(pd.DataFrame(df2))
if issubclass(collection, dict):
header, frames = serialize(
{"df1": df1, "df2": df2}, serializers=("cuda", "dask", "pickle")
diff --git a/distributed/protocol/tests/test_keras.py b/distributed/protocol/tests/test_keras.py
index da8cdf63..05f3c7ca 100644
--- a/distributed/protocol/tests/test_keras.py
+++ b/distributed/protocol/tests/test_keras.py
@@ -1,13 +1,13 @@
-import numpy as np
-from numpy.testing import assert_allclose
import pytest
keras = pytest.importorskip("keras")
+np = pytest.importorskip("numpy")
from distributed.protocol import serialize, deserialize, dumps, loads, to_serialize
def test_serialize_deserialize_model():
+ from numpy.testing import assert_allclose
model = keras.models.Sequential()
model.add(keras.layers.Dense(5, input_dim=3))
model.add(keras.layers.Dense(2))
diff --git a/distributed/protocol/tests/test_numpy.py b/distributed/protocol/tests/test_numpy.py
index c52e4f5b..ebb709dd 100644
--- a/distributed/protocol/tests/test_numpy.py
+++ b/distributed/protocol/tests/test_numpy.py
@@ -1,8 +1,7 @@
from zlib import crc32
-import numpy as np
import pytest
-
+np = pytest.importorskip("numpy")
from distributed.protocol import (
serialize,
deserialize,
diff --git a/distributed/protocol/tests/test_pandas.py b/distributed/protocol/tests/test_pandas.py
index a8134d7e..6dd968eb 100644
--- a/distributed/protocol/tests/test_pandas.py
+++ b/distributed/protocol/tests/test_pandas.py
@@ -1,6 +1,6 @@
-import numpy as np
-import pandas as pd
import pytest
+pd = pytest.importorskip("pandas")
+np = pytest.importorskip("numpy")
from dask.dataframe.utils import assert_eq
diff --git a/distributed/protocol/tests/test_serialize.py b/distributed/protocol/tests/test_serialize.py
index 735dffb5..6ff76eb6 100644
--- a/distributed/protocol/tests/test_serialize.py
+++ b/distributed/protocol/tests/test_serialize.py
@@ -3,10 +3,11 @@ import copy
import pickle
import msgpack
-import numpy as np
import pytest
from tlz import identity
+np = pytest.importorskip("numpy")
+
from dask.utils_test import inc
from distributed import wait
diff --git a/distributed/protocol/tests/test_sparse.py b/distributed/protocol/tests/test_sparse.py
index 89f9da09..a08be59b 100644
--- a/distributed/protocol/tests/test_sparse.py
+++ b/distributed/protocol/tests/test_sparse.py
@@ -1,9 +1,10 @@
-import numpy as np
-from numpy.testing import assert_allclose
import pytest
+np = pytest.importorskip("numpy")
sparse = pytest.importorskip("sparse")
+from numpy.testing import assert_allclose
+
from distributed.protocol import deserialize, serialize
diff --git a/distributed/tests/test_actor.py b/distributed/tests/test_actor.py
index 7b91b3da..ee393d49 100644
--- a/distributed/tests/test_actor.py
+++ b/distributed/tests/test_actor.py
@@ -426,7 +426,7 @@ async def test_load_balance_map(c, s, *workers):
@gen_cluster(client=True, nthreads=[("127.0.0.1", 1)] * 4, Worker=Nanny)
async def bench_param_server(c, s, *workers):
import dask.array as da
- import numpy as np
+ np = pytest.importorskip("numpy")
x = da.random.random((500000, 1000), chunks=(1000, 1000))
x = x.persist()
diff --git a/distributed/tests/test_client.py b/distributed/tests/test_client.py
index 100b52ea..40716c40 100644
--- a/distributed/tests/test_client.py
+++ b/distributed/tests/test_client.py
@@ -5526,7 +5526,7 @@ async def test_client_active_bad_port():
def test_turn_off_pickle(direct):
@gen_cluster()
async def test(s, a, b):
- import numpy as np
+ np = pytest.importorskip("numpy")
async with Client(
s.address, asynchronous=True, serializers=["dask", "msgpack"]
@@ -5564,7 +5564,7 @@ def test_turn_off_pickle(direct):
@gen_cluster()
async def test_de_serialization(s, a, b):
- import numpy as np
+ np = pytest.importorskip("numpy")
c = await Client(
s.address,
@@ -5585,7 +5585,7 @@ async def test_de_serialization(s, a, b):
@gen_cluster()
async def test_de_serialization_none(s, a, b):
- import numpy as np
+ np = pytest.importorskip("numpy")
c = await Client(s.address, asynchronous=True, deserializers=["msgpack"])
try:
@@ -6424,7 +6424,7 @@ async def test_annotations_retries(c, s, a, b):
async def test_annotations_blockwise_unpack(c, s, a, b):
da = pytest.importorskip("dask.array")
from dask.array.utils import assert_eq
- import numpy as np
+ np = pytest.importorskip("numpy")
# A flaky doubling function -- need extra args because it is called before
# application to establish dtype/meta.
diff --git a/distributed/tests/test_collections.py b/distributed/tests/test_collections.py
index 022db408..8b3e6cd5 100644
--- a/distributed/tests/test_collections.py
+++ b/distributed/tests/test_collections.py
@@ -2,8 +2,8 @@ from distutils.version import LooseVersion
import pytest
-pytest.importorskip("numpy")
-pytest.importorskip("pandas")
+np = pytest.importorskip("numpy")
+pd = pytest.importorskip("pandas")
import dask
import dask.dataframe as dd
@@ -11,8 +11,6 @@ import dask.bag as db
from distributed.client import wait
from distributed.utils_test import gen_cluster
from distributed.utils_test import client, cluster_fixture, loop # noqa F401
-import numpy as np
-import pandas as pd
PANDAS_VERSION = LooseVersion(pd.__version__)
PANDAS_GT_100 = PANDAS_VERSION >= LooseVersion("1.0.0")
diff --git a/distributed/tests/test_nanny.py b/distributed/tests/test_nanny.py
index 1993f11a..83c3de18 100644
--- a/distributed/tests/test_nanny.py
+++ b/distributed/tests/test_nanny.py
@@ -7,8 +7,6 @@ import random
import sys
import multiprocessing as mp
-import numpy as np
-
import pytest
from tlz import valmap, first
from tornado.ioloop import IOLoop
@@ -202,6 +200,7 @@ async def test_random_seed(c, s, a, b):
assert x != y
await check_func(lambda a, b: random.randint(a, b))
+ np = pytest.importorskip("numpy")
await check_func(lambda a, b: np.random.randint(a, b))
diff --git a/distributed/tests/test_pubsub.py b/distributed/tests/test_pubsub.py
index 8f8a3b73..09ab4dcd 100644
--- a/distributed/tests/test_pubsub.py
+++ b/distributed/tests/test_pubsub.py
@@ -37,7 +37,7 @@ async def test_speed(c, s, a, b):
# print(a, b, i)
return n
- import numpy as np
+ np = pytest.importorskip("numpy")
x = np.random.random(1000)
diff --git a/distributed/tests/test_utils.py b/distributed/tests/test_utils.py
index 022e9925..ffda15a6 100644
--- a/distributed/tests/test_utils.py
+++ b/distributed/tests/test_utils.py
@@ -10,7 +10,6 @@ import sys
from time import sleep
import traceback
-import numpy as np
import pytest
from tornado.ioloop import IOLoop
@@ -271,6 +270,7 @@ def test_ensure_bytes():
def test_ensure_bytes_ndarray():
+ np = pytest.importorskip("numpy")
result = ensure_bytes(np.arange(12))
assert isinstance(result, bytes)
@@ -283,6 +283,7 @@ def test_ensure_bytes_pyarrow_buffer():
def test_nbytes():
+ np = pytest.importorskip("numpy")
def check(obj, expected):
assert nbytes(obj) == expected
assert nbytes(memoryview(obj)) == expected