Skip to content

Commit

Permalink
cleanup unit test imports and remove nx warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralph Liu committed Jul 18, 2023
1 parent 864402d commit ab699be
Show file tree
Hide file tree
Showing 82 changed files with 281 additions and 505 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@
import gc

import pytest

import cugraph
from cugraph.datasets import karate_disjoint
from cugraph.testing import utils, SMALL_DATASETS
import random
import numpy as np
import networkx as nx

import cudf
import cupy

import networkx as nx
import cugraph
from cugraph.datasets import karate_disjoint
from cugraph.testing import utils, SMALL_DATASETS


# =============================================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import cugraph.dask as dcg
import gc

import pytest
import cugraph

import dask_cudf
import cupy
import cudf


# from cugraph.dask.common.mg_utils import is_single_gpu
import cugraph
import cugraph.dask as dcg
from cugraph.testing import utils
from pylibcugraph.testing import gen_fixture_params_product

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@
import gc

import pytest
import networkx as nx

import cudf
import cugraph
from cugraph.testing import utils, UNDIRECTED_DATASETS

import networkx as nx


# =============================================================================
# Pytest Setup / Teardown - called for each test function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
# limitations under the License.

import gc

import pytest

import cudf
import dask_cudf
from cudf.testing import assert_series_equal

import cugraph
from cugraph.dask.common.mg_utils import is_single_gpu
from cugraph.testing.utils import RAPIDS_DATASET_ROOT_DIR_PATH
from cudf.testing import assert_series_equal

# =============================================================================
# Pytest Setup / Teardown - called for each test function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,16 @@
import gc

import pytest

import cugraph
from cugraph.datasets import karate_disjoint
from cugraph.testing import utils, SMALL_DATASETS
import random
import networkx as nx
import numpy as np

import cupy
import cudf
import cugraph
from cugraph.datasets import karate_disjoint
from cugraph.testing import utils, SMALL_DATASETS

# Temporarily suppress warnings till networkX fixes deprecation warnings
# (Using or importing the ABCs from 'collections' instead of from
# 'collections.abc' is deprecated, and in 3.8 it will stop working) for
# python 3.7. Also, this import networkx needs to be relocated in the
# third-party group once this gets fixed.
import warnings

with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
import networkx as nx

# NOTE: Endpoint parameter is not currently being tested, there could be a test
# to verify that python raise an error if it is used
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
import gc

import pytest
import networkx as nx

import cugraph
from cugraph.testing import utils, UNDIRECTED_DATASETS, DEFAULT_DATASETS
from cugraph.datasets import toy_graph, karate

import networkx as nx

# This toy graph is used in multiple tests throughout libcugraph_c and pylib.
TOY = toy_graph
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# import numpy as np
import pytest
import cugraph.dask as dcg
import gc
import cugraph
import dask_cudf

import pytest

import cudf
import dask_cudf
import cugraph
import cugraph.dask as dcg
from cugraph.dask.common.mg_utils import is_single_gpu
from cugraph.testing.utils import DATASETS

Expand Down
11 changes: 1 addition & 10 deletions python/cugraph/cugraph/tests/centrality/test_katz_centrality.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import gc

import pytest
import networkx as nx

import cudf
import cugraph
Expand All @@ -24,16 +25,6 @@
)
from cugraph.datasets import toy_graph_undirected, karate

# Temporarily suppress warnings till networkX fixes deprecation warnings
# (Using or importing the ABCs from 'collections' instead of from
# 'collections.abc' is deprecated, and in 3.8 it will stop working) for
# python 3.7. Also, this import networkx needs to be relocated in the
# third-party group once this gets fixed.
import warnings

with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
import networkx as nx

# This toy graph is used in multiple tests throughout libcugraph_c and pylib.
TOY = toy_graph_undirected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# import numpy as np
import pytest
import cugraph.dask as dcg
import gc
import cugraph
import dask_cudf

import pytest

import cudf
import dask_cudf
import cugraph
import cugraph.dask as dcg
from cugraph.dask.common.mg_utils import is_single_gpu
from cugraph.testing.utils import RAPIDS_DATASET_ROOT_DIR_PATH

Expand Down
10 changes: 4 additions & 6 deletions python/cugraph/cugraph/tests/comms/test_comms_mg.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import gc

import pytest
import cugraph.dask as dcg
import gc

# import pytest
import cugraph
import dask_cudf
import cudf

# from cugraph.dask.common.mg_utils import is_single_gpu
import dask_cudf
import cugraph
from cugraph.testing.utils import RAPIDS_DATASET_ROOT_DIR_PATH

# =============================================================================
Expand Down
3 changes: 2 additions & 1 deletion python/cugraph/cugraph/tests/community/test_balanced_cut.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
# limitations under the License.

import gc
import random

import random
import pytest
import networkx as nx
import pandas as pd

import cudf
import cugraph
from cugraph.testing import DEFAULT_DATASETS
Expand Down
5 changes: 2 additions & 3 deletions python/cugraph/cugraph/tests/community/test_ecg.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@
# limitations under the License.

import gc
from pathlib import PurePath

import pytest
import networkx as nx
import cugraph

import cugraph
from cugraph.testing import utils
from cugraph.datasets import karate, dolphins, netscience

from pathlib import PurePath


def cugraph_call(G, min_weight, ensemble_size):
df = cugraph.ecg(G, min_weight, ensemble_size)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
# limitations under the License.

import gc

import pytest

import dask_cudf
import cudf
from cudf.testing.testing import assert_frame_equal
from pylibcugraph.testing import gen_fixture_params_product

import dask_cudf
import cugraph
import cugraph.dask as dcg
from cugraph.testing import utils
from cugraph.dask.common.mg_utils import is_single_gpu
import cudf
from pylibcugraph.testing import gen_fixture_params_product


# =============================================================================
Expand Down
16 changes: 2 additions & 14 deletions python/cugraph/cugraph/tests/community/test_k_truss_subgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,14 @@
import gc

import pytest

import networkx as nx
import numpy as np
from numba import cuda

import cugraph
from cugraph.testing import utils
from cugraph.datasets import polbooks, ktruss_polbooks, karate_asymmetric
from numba import cuda

# Temporarily suppress warnings till networkX fixes deprecation warnings
# (Using or importing the ABCs from 'collections' instead of from
# 'collections.abc' is deprecated, and in 3.8 it will stop working) for
# python 3.7. Also, this import networkx needs to be relocated in the
# third-party group once this gets fixed.
import warnings

with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
import networkx as nx

print("Networkx version : {} ".format(nx.__version__))

DATASETS_KTRUSS = [(polbooks, ktruss_polbooks)]

Expand Down
2 changes: 1 addition & 1 deletion python/cugraph/cugraph/tests/community/test_leiden.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import time

import pytest

import networkx as nx

import cugraph
import cudf
from cugraph.testing import utils, UNDIRECTED_DATASETS
Expand Down
5 changes: 2 additions & 3 deletions python/cugraph/cugraph/tests/community/test_leiden_mg.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@

import pytest

import cugraph.dask as dcg

import cugraph
import dask_cudf
import cugraph
import cugraph.dask as dcg
from cugraph.testing import utils

# from cugraph.dask.common.mg_utils import is_single_gpu

try:
from rapids_pytest_benchmark import setFixtureParamNames
Expand Down
13 changes: 2 additions & 11 deletions python/cugraph/cugraph/tests/community/test_louvain.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,17 @@
# limitations under the License.

import gc
import time

import time
import pytest
import networkx as nx

import cugraph
import cupyx
import cudf
from cugraph.testing import utils, UNDIRECTED_DATASETS
from cugraph.datasets import karate_asymmetric

# Temporarily suppress warnings till networkX fixes deprecation warnings
# (Using or importing the ABCs from 'collections' instead of from
# 'collections.abc' is deprecated, and in 3.8 it will stop working) for
# python 3.7. Also, these import community and import networkx need to be
# relocated in the third-party group once this gets fixed.
import warnings

with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
import networkx as nx

try:
import community
Expand Down
1 change: 0 additions & 1 deletion python/cugraph/cugraph/tests/community/test_louvain_mg.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import dask_cudf
from cugraph.testing import utils

# from cugraph.dask.common.mg_utils import is_single_gpu

try:
from rapids_pytest_benchmark import setFixtureParamNames
Expand Down
5 changes: 2 additions & 3 deletions python/cugraph/cugraph/tests/community/test_modularity.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@
# limitations under the License.

import gc
import random

import random
import pytest
import networkx as nx

import cudf
import cugraph
from cugraph.testing import utils, DEFAULT_DATASETS
from cugraph.utilities import ensure_cugraph_obj_for_nx

import networkx as nx


def cugraph_call(G, partitions):
df = cugraph.spectralModularityMaximizationClustering(
Expand Down
Loading

0 comments on commit ab699be

Please sign in to comment.