From 04742256a5f940ef42404c03371e5f0e41b4f936 Mon Sep 17 00:00:00 2001 From: Michal Zientkiewicz Date: Mon, 4 Nov 2024 11:29:17 +0100 Subject: [PATCH] Import regrouping. Signed-off-by: Michal Zientkiewicz --- dali/test/python/checkpointing/test_dali_checkpointing.py | 3 +-- .../checkpointing/test_dali_checkpointing_fw_iterators.py | 3 +-- dali/test/python/decoder/test_imgcodec.py | 3 +-- dali/test/python/decoder/test_jpeg_scan_limit.py | 3 +-- dali/test/python/decoder/test_video.py | 4 +--- dali/test/python/operator_1/test_arithmetic_ops.py | 3 +-- dali/test/python/operator_1/test_crop_mirror_normalize.py | 3 +-- dali/test/python/operator_1/test_gaussian_blur.py | 3 +-- dali/test/python/operator_1/test_laplacian.py | 3 +-- dali/test/python/operator_1/test_numba_func.py | 3 +-- dali/test/python/operator_2/test_random_object_bbox.py | 3 +-- dali/test/python/operator_2/test_reduce.py | 3 +-- dali/test/python/reader/test_index.py | 3 +-- dali/test/python/reader/test_numpy.py | 3 +-- dali/test/python/reader/test_webdataset_corner.py | 3 +-- dali/test/python/reader/test_webdataset_requirements.py | 3 +-- dali/test/python/test_backend_impl.py | 3 +-- dali/test/python/test_dali_cpu_only.py | 3 +-- dali/test/python/test_dali_tf_dataset_eager.py | 3 +-- dali/test/python/test_dali_tf_dataset_graph.py | 4 +--- dali/test/python/test_dali_tf_dataset_mnist_eager.py | 4 +--- dali/test/python/test_external_source_impl_utils.py | 3 +-- dali/test/python/test_functional_api.py | 3 +-- dali/test/python/test_optical_flow.py | 3 +-- dali/test/python/test_pipeline_debug.py | 5 +---- dali/test/python/test_pipeline_inputs.py | 3 +-- dali/test/python/test_torch_pipeline_rnnt.py | 3 +-- 27 files changed, 27 insertions(+), 59 deletions(-) diff --git a/dali/test/python/checkpointing/test_dali_checkpointing.py b/dali/test/python/checkpointing/test_dali_checkpointing.py index a55b595d062..89a27b7f101 100644 --- a/dali/test/python/checkpointing/test_dali_checkpointing.py +++ b/dali/test/python/checkpointing/test_dali_checkpointing.py @@ -27,7 +27,7 @@ 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 @@ -35,7 +35,6 @@ 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_utils import attr reader_signed_off = create_sign_off_decorator() diff --git a/dali/test/python/checkpointing/test_dali_checkpointing_fw_iterators.py b/dali/test/python/checkpointing/test_dali_checkpointing_fw_iterators.py index 2600af8f2d0..941608c2b3d 100644 --- a/dali/test/python/checkpointing/test_dali_checkpointing_fw_iterators.py +++ b/dali/test/python/checkpointing/test_dali_checkpointing_fw_iterators.py @@ -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_utils import SkipTest class FwTestBase: diff --git a/dali/test/python/decoder/test_imgcodec.py b/dali/test/python/decoder/test_imgcodec.py index fce0b853fac..54a6a1fad77 100644 --- a/dali/test/python/decoder/test_imgcodec.py +++ b/dali/test/python/decoder/test_imgcodec.py @@ -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_utils import SkipTest def get_img_files(data_path, subdir="*", ext=None): diff --git a/dali/test/python/decoder/test_jpeg_scan_limit.py b/dali/test/python/decoder/test_jpeg_scan_limit.py index 9728bc11a7d..eb4b2949f05 100644 --- a/dali/test/python/decoder/test_jpeg_scan_limit.py +++ b/dali/test/python/decoder/test_jpeg_scan_limit.py @@ -18,8 +18,7 @@ import unittest from nvidia.dali import pipeline_def -from nose_utils import assert_raises -from nose_utils import attr +from nose_utils import assert_raises, attr from nose2.tools import cartesian_params diff --git a/dali/test/python/decoder/test_video.py b/dali/test/python/decoder/test_video.py index 0adc06eb608..d12bd740429 100644 --- a/dali/test/python/decoder/test_video.py +++ b/dali/test/python/decoder/test_video.py @@ -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_utils import SkipTest -from nose_utils 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") diff --git a/dali/test/python/operator_1/test_arithmetic_ops.py b/dali/test/python/operator_1/test_arithmetic_ops.py index d28dfec20fb..76d3c0ac69d 100644 --- a/dali/test/python/operator_1/test_arithmetic_ops.py +++ b/dali/test/python/operator_1/test_arithmetic_ops.py @@ -19,12 +19,11 @@ import nvidia.dali.math as math from nvidia.dali.tensors import TensorListGPU import numpy as np -from nose_utils import attr +from nose_utils import attr, aises, 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): diff --git a/dali/test/python/operator_1/test_crop_mirror_normalize.py b/dali/test/python/operator_1/test_crop_mirror_normalize.py index 022e1f50dd2..a1de4e39207 100644 --- a/dali/test/python/operator_1/test_crop_mirror_normalize.py +++ b/dali/test/python/operator_1/test_crop_mirror_normalize.py @@ -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 diff --git a/dali/test/python/operator_1/test_gaussian_blur.py b/dali/test/python/operator_1/test_gaussian_blur.py index 76717dc9a8c..c4b570ae6c8 100644 --- a/dali/test/python/operator_1/test_gaussian_blur.py +++ b/dali/test/python/operator_1/test_gaussian_blur.py @@ -21,8 +21,7 @@ import cv2 from scipy.ndimage import convolve1d import os -from nose_utils import assert_raises, raises -from nose_utils import attr +from nose_utils import assert_raises, raises, attr from sequences_test_utils import video_suite_helper, ArgCb from test_utils import ( diff --git a/dali/test/python/operator_1/test_laplacian.py b/dali/test/python/operator_1/test_laplacian.py index 7d773fe28fe..30990706f7a 100644 --- a/dali/test/python/operator_1/test_laplacian.py +++ b/dali/test/python/operator_1/test_laplacian.py @@ -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_utils 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 diff --git a/dali/test/python/operator_1/test_numba_func.py b/dali/test/python/operator_1/test_numba_func.py index 3e84f037484..672ebe825f3 100644 --- a/dali/test/python/operator_1/test_numba_func.py +++ b/dali/test/python/operator_1/test_numba_func.py @@ -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, @@ -28,7 +28,6 @@ ) from nvidia.dali.plugin.numba.fn.experimental import numba_function from numba import cuda -from nose_utils import attr test_data_root = get_dali_extra_path() lmdb_folder = os.path.join(test_data_root, "db", "lmdb") diff --git a/dali/test/python/operator_2/test_random_object_bbox.py b/dali/test/python/operator_2/test_random_object_bbox.py index 4b725dd4a33..bdf7e10ac86 100644 --- a/dali/test/python/operator_2/test_random_object_bbox.py +++ b/dali/test/python/operator_2/test_random_object_bbox.py @@ -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 @@ -23,7 +23,6 @@ import scipy.ndimage.measurements import random from test_utils import check_batch, np_type_to_dali -from nose_utils import attr, nottest np.random.seed(1234) diff --git a/dali/test/python/operator_2/test_reduce.py b/dali/test/python/operator_2/test_reduce.py index 74f89237bf0..ae5fe334854 100644 --- a/dali/test/python/operator_2/test_reduce.py +++ b/dali/test/python/operator_2/test_reduce.py @@ -14,12 +14,11 @@ import nvidia.dali.fn as fn from nvidia.dali.pipeline import Pipeline -from nose_utils 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: diff --git a/dali/test/python/reader/test_index.py b/dali/test/python/reader/test_index.py index 1c9dc3e7667..78b2bd17397 100644 --- a/dali/test/python/reader/test_index.py +++ b/dali/test/python/reader/test_index.py @@ -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_utils import SkipTest def skip_second(src, dst): diff --git a/dali/test/python/reader/test_numpy.py b/dali/test/python/reader/test_numpy.py index b4651387db0..40468ac5397 100644 --- a/dali/test/python/reader/test_numpy.py +++ b/dali/test/python/reader/test_numpy.py @@ -22,8 +22,7 @@ import platform import random import tempfile -from nose_utils import assert_raises -from nose_utils import SkipTest +from nose_utils import assert_raises, SkipTest from nose2.tools import params, cartesian_params from test_utils import compare_pipelines, to_array diff --git a/dali/test/python/reader/test_webdataset_corner.py b/dali/test/python/reader/test_webdataset_corner.py index afeb452ed2d..bc20011859d 100644 --- a/dali/test/python/reader/test_webdataset_corner.py +++ b/dali/test/python/reader/test_webdataset_corner.py @@ -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 diff --git a/dali/test/python/reader/test_webdataset_requirements.py b/dali/test/python/reader/test_webdataset_requirements.py index 44cdfc86916..09aa47c942a 100644 --- a/dali/test/python/reader/test_webdataset_requirements.py +++ b/dali/test/python/reader/test_webdataset_requirements.py @@ -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, diff --git a/dali/test/python/test_backend_impl.py b/dali/test/python/test_backend_impl.py index a195c81735c..23a0e83c1dc 100644 --- a/dali/test/python/test_backend_impl.py +++ b/dali/test/python/test_backend_impl.py @@ -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_utils 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 diff --git a/dali/test/python/test_dali_cpu_only.py b/dali/test/python/test_dali_cpu_only.py index 478b8f84637..fc779655a23 100644 --- a/dali/test/python/test_dali_cpu_only.py +++ b/dali/test/python/test_dali_cpu_only.py @@ -22,12 +22,11 @@ import os import re from collections.abc import Iterable -from nose_utils import attr, 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, diff --git a/dali/test/python/test_dali_tf_dataset_eager.py b/dali/test/python/test_dali_tf_dataset_eager.py index ed59e229707..ee3b15ec716 100644 --- a/dali/test/python/test_dali_tf_dataset_eager.py +++ b/dali/test/python/test_dali_tf_dataset_eager.py @@ -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, @@ -46,7 +46,6 @@ skip_for_incompatible_tf, skip_inputs_for_incompatible_tf, ) -from nose_utils import raises import random as random import itertools diff --git a/dali/test/python/test_dali_tf_dataset_graph.py b/dali/test/python/test_dali_tf_dataset_graph.py index 2ceb89921fb..32702536a8f 100644 --- a/dali/test/python/test_dali_tf_dataset_graph.py +++ b/dali/test/python/test_dali_tf_dataset_graph.py @@ -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, diff --git a/dali/test/python/test_dali_tf_dataset_mnist_eager.py b/dali/test/python/test_dali_tf_dataset_mnist_eager.py index 2142d79bacf..dd742c314de 100644 --- a/dali/test/python/test_dali_tf_dataset_mnist_eager.py +++ b/dali/test/python/test_dali_tf_dataset_mnist_eager.py @@ -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_utils import SkipTest from packaging.version import Version tf.compat.v1.enable_eager_execution() diff --git a/dali/test/python/test_external_source_impl_utils.py b/dali/test/python/test_external_source_impl_utils.py index 68b23f2a0ba..28eca9b20c1 100644 --- a/dali/test/python/test_external_source_impl_utils.py +++ b/dali/test/python/test_external_source_impl_utils.py @@ -15,8 +15,7 @@ from nvidia.dali._utils import external_source_impl from nvidia.dali import tensors, pipeline_def import nvidia.dali.fn as fn -from nose_utils import raises, assert_equals -from nose_utils import attr +from nose_utils import raises, assert_equals, attr import numpy as np diff --git a/dali/test/python/test_functional_api.py b/dali/test/python/test_functional_api.py index 7eaa22645f1..73f5c35adaa 100644 --- a/dali/test/python/test_functional_api.py +++ b/dali/test/python/test_functional_api.py @@ -17,10 +17,9 @@ from nvidia.dali.pipeline import Pipeline import nvidia.dali.types as types import numpy as np -from nose_utils import assert_raises +from nose_utils import assert_raises, attr import sys import inspect -from nose_utils import attr import nose diff --git a/dali/test/python/test_optical_flow.py b/dali/test/python/test_optical_flow.py index 494f8bfa3c9..61b57da3aa2 100644 --- a/dali/test/python/test_optical_flow.py +++ b/dali/test/python/test_optical_flow.py @@ -20,8 +20,7 @@ from nvidia.dali.pipeline import pipeline_def from nvidia.dali import fn, types from test_utils import get_dali_extra_path, get_arch -from nose_utils import raises, assert_raises -from nose_utils import SkipTest +from nose_utils import raises, assert_raises, SkipTest test_data_root = get_dali_extra_path() images_dir = os.path.join(test_data_root, "db", "imgproc") diff --git a/dali/test/python/test_pipeline_debug.py b/dali/test/python/test_pipeline_debug.py index b291a37fe75..b3dee99d910 100644 --- a/dali/test/python/test_pipeline_debug.py +++ b/dali/test/python/test_pipeline_debug.py @@ -14,15 +14,12 @@ import numpy as np import os -from nose_utils import attr - from nvidia.dali import fn from nvidia.dali import tensors from nvidia.dali import types from nvidia.dali.pipeline.experimental import pipeline_def -from nose_utils import raises +from nose_utils import attr, raises, assert_raises from test_utils import compare_pipelines, get_dali_extra_path -from nose_utils import assert_raises from conditionals.test_pipeline_conditionals import ( pred_gens, diff --git a/dali/test/python/test_pipeline_inputs.py b/dali/test/python/test_pipeline_inputs.py index fb535757534..1a505b7de9a 100644 --- a/dali/test/python/test_pipeline_inputs.py +++ b/dali/test/python/test_pipeline_inputs.py @@ -15,13 +15,12 @@ import numpy as np import nvidia.dali.fn as fn -from nose_utils import attr +from nose_utils import attr, raises from nose2.tools import params from numpy.random import default_rng from nvidia.dali import pipeline_def from nvidia.dali.tensors import TensorCPU, TensorGPU -from nose_utils import raises from test_utils import to_array max_batch_size = 256 diff --git a/dali/test/python/test_torch_pipeline_rnnt.py b/dali/test/python/test_torch_pipeline_rnnt.py index 2c252c46d14..d294fb7fefb 100644 --- a/dali/test/python/test_torch_pipeline_rnnt.py +++ b/dali/test/python/test_torch_pipeline_rnnt.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import nose_utils # noqa:F401 - for Python 3.10 +from nose_utils import nottest import nvidia.dali.fn as fn from nvidia.dali import pipeline_def import nvidia.dali.types as types @@ -23,7 +23,6 @@ import math import random import os -from nose_utils import nottest # Filtering librispeech samples audio_files = get_files("db/audio/wav", "wav")