Skip to content
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

Fix nose imports #5698

Merged
merged 4 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions dali/test/python/checkpointing/test_dali_checkpointing.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@
get_dali_extra_path,
module_functions,
)
from nose_utils import assert_warns, assert_raises
from nose_utils import assert_warns, assert_raises, attr
from nose2.tools import params, cartesian_params
from dataclasses import dataclass
from nvidia.dali import tfrecord as tfrec
from nvidia.dali.auto_aug import auto_augment as aa
from nvidia.dali.auto_aug import rand_augment as ra
from nvidia.dali.auto_aug import trivial_augment as ta
from reader.test_numpy import is_gds_supported
from nose.plugins.attrib import attr


reader_signed_off = create_sign_off_decorator()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@
make_external_source_test_pipeline_factory,
images_dir,
)
from nose_utils import assert_raises
from nose_utils import assert_raises, SkipTest
import nvidia.dali.fn as fn
from nvidia.dali.pipeline import pipeline_def
from nose2.tools import params, cartesian_params
import numpy as np
from nvidia.dali.plugin.base_iterator import LastBatchPolicy
from nose import SkipTest


class FwTestBase:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
restrict_platform,
)
from nose2.tools import params, cartesian_params
from nose_utils import assert_raises, SkipTest
from nose.plugins.attrib import attr
from nose_utils import assert_raises, SkipTest, attr

# Test configuration
batch_size = 8
Expand Down
5 changes: 2 additions & 3 deletions dali/test/python/decoder/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from nvidia.dali import pipeline_def

from nose2.tools import params
from nose_utils import assert_raises
from nose_utils import assert_raises, SkipTest
from test_utils import check_output_pattern
from test_utils import compare_pipelines
from test_utils import get_dali_extra_path
Expand Down Expand Up @@ -279,9 +279,8 @@ def check_fancy_upsampling_body(batch_size, img_type, device):
@params(1, 8)
def test_fancy_upsampling(batch_size):
if nvidia.dali.backend.GetNvjpegVersion() < 12001:
from nose import SkipTest

raise SkipTest("nvJPEG doesn't support fancy upsampling in this version")

data_path = os.path.join(test_data_root, good_path, "jpeg")
compare_pipelines(
decoder_pipe(
Expand Down
6 changes: 2 additions & 4 deletions dali/test/python/decoder/test_imgcodec.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@
import random
from nvidia.dali import pipeline_def

from nose_utils import assert_raises
from nose_utils import assert_raises, SkipTest
from test_utils import compare_pipelines
from test_utils import get_dali_extra_path
from test_utils import to_array
from test_utils import get_arch
from test_utils import dump_as_core_artifacts
from nose2.tools import params
from nose import SkipTest


def get_img_files(data_path, subdir="*", ext=None):
Expand Down Expand Up @@ -280,9 +279,8 @@ def check_fancy_upsampling_body(batch_size, img_type, device):
@params(1, 8)
def test_fancy_upsampling(batch_size):
if nvidia.dali.backend.GetNvjpegVersion() < 12001:
from nose import SkipTest

raise SkipTest("nvJPEG doesn't support fancy upsampling in this version")

data_path = os.path.join(test_data_root, good_path, "jpeg")
compare_pipelines(
decoder_pipe(
Expand Down
3 changes: 1 addition & 2 deletions dali/test/python/decoder/test_jpeg_scan_limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
import unittest
from nvidia.dali import pipeline_def

from nose_utils import assert_raises
from nose.plugins.attrib import attr
from nose_utils import assert_raises, attr
from nose2.tools import cartesian_params


Expand Down
4 changes: 1 addition & 3 deletions dali/test/python/decoder/test_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
from test_utils import get_dali_extra_path, is_mulit_gpu, skip_if_m60
from nvidia.dali.backend import TensorListGPU
from nose2.tools import params
from nose import SkipTest
from nose.plugins.attrib import attr
from nose_utils import assert_raises
from nose_utils import SkipTest, attr, assert_raises


filenames = glob.glob(f"{get_dali_extra_path()}/db/video/[cv]fr/*.mp4")
Expand Down
4 changes: 1 addition & 3 deletions dali/test/python/dlpack/test_torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import nvidia.dali.fn as fn
import torch
import numpy as np
from nose.plugins.attrib import attr
from nose_utils import attr


@dali.pipeline_def(batch_size=4, num_threads=1, device_id=0, prefetch_queue_depth=2)
Expand All @@ -16,7 +16,6 @@ def _test_pipe():

@attr("pytorch")
def test_dlpack_is_zero_copy():
print("Testing dlpack")
# get a DALI pipeline that produces batches of very large tensors
pipe = _test_pipe(batch_size=1, experimental_exec_dynamic=True)
pipe.build()
Expand All @@ -34,7 +33,6 @@ def test_dlpack_is_zero_copy():

@attr("pytorch")
def test_dlpack_no_corruption():
print("Testing dlpack")
# get a DALI pipeline that produces batches of very large tensors
pipe = _test_pipe(experimental_exec_dynamic=True)
pipe.build()
Expand Down
2 changes: 1 addition & 1 deletion dali/test/python/dlpack/test_torch_perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import torch
import numpy as np
import time
from nose.plugins.attrib import attr
from nose_utils import attr


@dali.pipeline_def(batch_size=32, num_threads=8, device_id=0)
Expand Down
4 changes: 3 additions & 1 deletion dali/test/python/nose_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -101,6 +101,8 @@ def release_lock():
import nose.suite
import nose.plugins.attrib
from nose import SkipTest, with_setup # noqa: F401
from nose.plugins.attrib import attr # noqa: F401
from nose.tools import nottest # noqa: F401
Dismissed Show dismissed Hide dismissed

Dismissed Show dismissed Hide dismissed
if sys.version_info >= (3, 10) and not hasattr(collections, "Callable"):
nose.case.collections = collections.abc
Expand Down
3 changes: 1 addition & 2 deletions dali/test/python/operator_1/test_arithmetic_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@
import nvidia.dali.math as math
from nvidia.dali.tensors import TensorListGPU
import numpy as np
from nose.plugins.attrib import attr
from nose_utils import attr, raises, assert_raises, assert_equals
from nose2.tools import params
import itertools

from test_utils import np_type_to_dali
from nose_utils import raises, assert_raises, assert_equals


def list_product(*args):
Expand Down
2 changes: 1 addition & 1 deletion dali/test/python/operator_1/test_cast.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import numpy as np
import nvidia.dali.fn as fn
import nvidia.dali.types as types
from nose.tools import nottest
from nose_utils import nottest
from nvidia.dali import pipeline_def
from test_utils import np_type_to_dali
import itertools
Expand Down
3 changes: 1 addition & 2 deletions dali/test/python/operator_1/test_crop_mirror_normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
from nvidia.dali.pipeline import Pipeline

from nose2.tools import params
from nose_utils import assert_raises
from nose_utils import raises
from nose_utils import raises, assert_raises
from test_slice import check_slice_output, abs_slice_start_and_end
from test_utils import RandomDataIterator
from test_utils import as_array
Expand Down
3 changes: 1 addition & 2 deletions dali/test/python/operator_1/test_gaussian_blur.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
import cv2
from scipy.ndimage import convolve1d
import os
from nose_utils import assert_raises, raises
from nose.plugins.attrib import attr
from nose_utils import assert_raises, raises, attr

from sequences_test_utils import video_suite_helper, ArgCb
from test_utils import (
Expand Down
3 changes: 1 addition & 2 deletions dali/test/python/operator_1/test_laplacian.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
import cv2
from scipy.ndimage import convolve1d, filters as sp_filters
import os
from nose_utils import assert_raises
from nose.plugins.attrib import attr
from nose_utils import assert_raises, attr

from sequences_test_utils import video_suite_helper, ArgCb
from test_utils import get_dali_extra_path, check_batch, RandomlyShapedDataIterator
Expand Down
3 changes: 1 addition & 2 deletions dali/test/python/operator_1/test_numba_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import nvidia.dali as dali
import nvidia.dali.fn as fn
import nvidia.dali.types as dali_types
from nose_utils import with_setup
from nose_utils import with_setup, attr
from test_utils import (
get_dali_extra_path,
to_array,
Expand All @@ -28,7 +28,6 @@
)
from nvidia.dali.plugin.numba.fn.experimental import numba_function
from numba import cuda
from nose.plugins.attrib import attr

test_data_root = get_dali_extra_path()
lmdb_folder = os.path.join(test_data_root, "db", "lmdb")
Expand Down
2 changes: 1 addition & 1 deletion dali/test/python/operator_2/test_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from nvidia.dali import pipeline_def, fn, types
from test_utils import get_dali_extra_path, np_type_to_dali, check_batch
from nose2.tools import params
from nose.plugins.attrib import attr
from nose_utils import attr
from filter_test_utils import filter_baseline, filter_baseline_layout

data_root = get_dali_extra_path()
Expand Down
4 changes: 1 addition & 3 deletions dali/test/python/operator_2/test_random_object_bbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


# nose_utils goes first to deal with Python 3.10 incompatibility
from nose_utils import assert_raises
from nose_utils import attr, nottest, assert_raises
import nvidia.dali as dali
import nvidia.dali.fn as fn
import nvidia.dali.ops as ops
Expand All @@ -23,8 +23,6 @@
import scipy.ndimage.measurements
import random
from test_utils import check_batch, np_type_to_dali
from nose.tools import nottest
from nose.plugins.attrib import attr


np.random.seed(1234)
Expand Down
3 changes: 1 addition & 2 deletions dali/test/python/operator_2/test_reduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@

import nvidia.dali.fn as fn
from nvidia.dali.pipeline import Pipeline
from nose.tools import nottest
from nose_utils import nottest, assert_raises

import numpy as np

from test_utils import np_type_to_dali
from nose_utils import assert_raises


class Batch:
Expand Down
3 changes: 1 addition & 2 deletions dali/test/python/reader/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
import tempfile
import numpy as np
from test_utils import compare_pipelines, get_dali_extra_path
from nose_utils import assert_raises, raises
from nose_utils import assert_raises, raises, SkipTest
from nose2.tools import cartesian_params
from nose import SkipTest


def skip_second(src, dst):
Expand Down
3 changes: 1 addition & 2 deletions dali/test/python/reader/test_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
import platform
import random
import tempfile
from nose_utils import assert_raises
from nose import SkipTest
from nose_utils import assert_raises, SkipTest
from nose2.tools import params, cartesian_params
from test_utils import compare_pipelines, to_array

Expand Down
3 changes: 1 addition & 2 deletions dali/test/python/reader/test_webdataset_corner.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
import os
import tempfile
from glob import glob
from nose_utils import assert_equals
from nose_utils import assert_equals, assert_raises

import webdataset_base as base
from nose_utils import assert_raises
from test_utils import compare_pipelines, get_dali_extra_path


Expand Down
3 changes: 1 addition & 2 deletions dali/test/python/reader/test_webdataset_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
import math
import nvidia.dali as dali
from test_utils import compare_pipelines, get_dali_extra_path
from nose_utils import assert_raises
from nose_utils import assert_equals
from nose_utils import assert_raises, assert_equals
from webdataset_base import (
generate_temp_extract,
generate_temp_index_file,
Expand Down
3 changes: 1 addition & 2 deletions dali/test/python/test_backend_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
from nvidia.dali.backend_impl import types as types_
import nvidia.dali as dali

from nose_utils import assert_raises
from nose import SkipTest
from nose_utils import assert_raises, SkipTest
from test_utils import dali_type_to_np, py_buffer_from_address, get_device_memory_info


Expand Down
4 changes: 1 addition & 3 deletions dali/test/python/test_dali_cpu_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@
import os
import re
from collections.abc import Iterable
from nose.plugins.attrib import attr
from nose.tools import nottest
from nose_utils import attr, nottest, assert_raises
from nvidia.dali.pipeline import Pipeline, pipeline_def
from nvidia.dali.pipeline.experimental import pipeline_def as experimental_pipeline_def
from nvidia.dali.plugin.numba.fn.experimental import numba_function

from nose_utils import assert_raises
from segmentation_test_utils import make_batch_select_masks
from test_dali_cpu_only_utils import (
pipeline_arithm_ops_cpu,
Expand Down
3 changes: 1 addition & 2 deletions dali/test/python/test_dali_tf_dataset_eager.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import nvidia.dali.plugin.tf as dali_tf
from nvidia.dali.plugin.tf.experimental import Input
from nvidia.dali import fn
from nose_utils import with_setup
from nose_utils import with_setup, raises
from test_dali_tf_dataset_pipelines import (
FixedSampleIterator,
RandomSampleIterator,
Expand Down Expand Up @@ -46,7 +46,6 @@
skip_for_incompatible_tf,
skip_inputs_for_incompatible_tf,
)
from nose_utils import raises
import random as random
import itertools

Expand Down
4 changes: 1 addition & 3 deletions dali/test/python/test_dali_tf_dataset_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
import numpy as np
import random as random
import tensorflow as tf
from nose_utils import with_setup

from nose_utils import raises
from nose_utils import with_setup, raises
from test_dali_tf_dataset_pipelines import (
FixedSampleIterator,
external_source_tester,
Expand Down
2 changes: 1 addition & 1 deletion dali/test/python/test_dali_tf_dataset_mnist.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import tensorflow as tf
import tensorflow.compat.v1 as tf_v1
from packaging.version import Version
from nose import SkipTest
from nose_utils import SkipTest


TARGET = 0.8
Expand Down
4 changes: 1 addition & 3 deletions dali/test/python/test_dali_tf_dataset_mnist_eager.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
# limitations under the License.

import tensorflow as tf
from nose_utils import with_setup
from nose_utils import with_setup, raises, SkipTest

import test_dali_tf_dataset_mnist as mnist
from test_utils_tensorflow import skip_for_incompatible_tf, available_gpus
from nose_utils import raises
from nose import SkipTest
from packaging.version import Version

tf.compat.v1.enable_eager_execution()
Expand Down
2 changes: 1 addition & 1 deletion dali/test/python/test_dali_tf_dataset_pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import nvidia.dali.fn as fn
import nvidia.dali.plugin.tf as dali_tf
import tensorflow as tf
from nose.tools import nottest
from nose_utils import nottest
from nvidia.dali import pipeline_def

from test_utils import RandomlyShapedDataIterator
Expand Down
Loading
Loading