20
20
import pytest
21
21
22
22
import cudf
23
+ import cugraph
23
24
import dask_cudf
25
+ from cugraph import datasets
26
+ from cugraph .dask .common .mg_utils import is_single_gpu
27
+ from cugraph .datasets import karate
24
28
from cugraph .structure import Graph
25
29
from cugraph .testing import (
26
30
RAPIDS_DATASET_ROOT_DIR_PATH ,
29
33
SMALL_DATASETS ,
30
34
BENCHMARKING_DATASETS ,
31
35
)
32
- from cugraph import datasets
33
- from cugraph .dask .common .mg_utils import is_single_gpu
36
+
34
37
35
38
# Add the sg marker to all tests in this module.
36
39
pytestmark = pytest .mark .sg
37
40
38
41
39
42
###############################################################################
40
43
# Fixtures
44
+ ###############################################################################
41
45
42
46
43
47
# module fixture - called once for this module
@@ -201,21 +205,26 @@ def test_reader_dask(dask_client, dataset):
201
205
@pytest .mark .parametrize ("dataset" , ALL_DATASETS )
202
206
def test_get_edgelist (dataset ):
203
207
E = dataset .get_edgelist (download = True )
208
+
204
209
assert E is not None
210
+ assert isinstance (E , cudf .DataFrame )
205
211
206
212
207
213
@pytest .mark .skipif (is_single_gpu (), reason = "skipping MG testing on Single GPU system" )
208
214
@pytest .mark .skip (reason = "MG not supported on CI" )
209
215
@pytest .mark .parametrize ("dataset" , ALL_DATASETS )
210
216
def test_get_dask_edgelist (dask_client , dataset ):
211
217
E = dataset .get_dask_edgelist (download = True )
218
+
212
219
assert E is not None
220
+ assert isinstance (E , dask_cudf .DataFrame )
213
221
214
222
215
223
@pytest .mark .parametrize ("dataset" , ALL_DATASETS )
216
224
def test_get_graph (dataset ):
217
225
G = dataset .get_graph (download = True )
218
226
assert G is not None
227
+ assert isinstance (G , cugraph .Graph )
219
228
220
229
221
230
@pytest .mark .skipif (is_single_gpu (), reason = "skipping MG testing on Single GPU system" )
@@ -224,12 +233,14 @@ def test_get_graph(dataset):
224
233
def test_get_dask_graph (dask_client , dataset ):
225
234
G = dataset .get_dask_graph (download = True )
226
235
assert G is not None
236
+ # TODO Check G is a DistributedGraph
227
237
228
238
229
239
@pytest .mark .parametrize ("dataset" , ALL_DATASETS )
230
240
def test_metadata (dataset ):
231
241
M = dataset .metadata
232
242
assert M is not None
243
+ assert isinstance (M , dict )
233
244
234
245
235
246
@pytest .mark .parametrize ("dataset" , ALL_DATASETS )
@@ -346,32 +357,19 @@ def test_ctor_with_datafile():
346
357
assert ds .get_path () == karate_csv
347
358
348
359
349
- def test_unload ():
350
- email_csv = RAPIDS_DATASET_ROOT_DIR_PATH / "email-Eu-core.csv"
360
+ @pytest .mark .parametrize ("dataset" , [karate ])
361
+ def test_unload (dataset ):
362
+ assert dataset ._edgelist is None
351
363
352
- ds = datasets .Dataset (
353
- csv_file = email_csv .as_posix (),
354
- csv_col_names = ["src" , "dst" , "wgt" ],
355
- csv_col_dtypes = ["int32" , "int32" , "float32" ],
356
- )
364
+ dataset .get_edgelist ()
365
+ assert dataset ._edgelist is not None
366
+ dataset .unload ()
367
+ assert dataset ._edgelist is None
357
368
358
- # FIXME: another (better?) test would be to check free memory and assert
359
- # the memory use increases after get_*(), then returns to the pre-get_*()
360
- # level after unload(). However, that type of test may fail for several
361
- # reasons (the device being monitored is accidentally also being used by
362
- # another process, and the use of memory pools to name two). Instead, just
363
- # test that the internal members get cleared on unload().
364
- assert ds ._edgelist is None
365
-
366
- ds .get_edgelist ()
367
- assert ds ._edgelist is not None
368
- ds .unload ()
369
- assert ds ._edgelist is None
370
-
371
- ds .get_graph ()
372
- assert ds ._edgelist is not None
373
- ds .unload ()
374
- assert ds ._edgelist is None
369
+ dataset .get_graph ()
370
+ assert dataset ._edgelist is not None
371
+ dataset .unload ()
372
+ assert dataset ._edgelist is None
375
373
376
374
377
375
@pytest .mark .parametrize ("dataset" , ALL_DATASETS )
0 commit comments