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 3 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
2 changes: 1 addition & 1 deletion dali/test/python/checkpointing/test_dali_checkpointing.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
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
from nose_utils import attr


reader_signed_off = create_sign_off_decorator()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from nose2.tools import params, cartesian_params
import numpy as np
from nvidia.dali.plugin.base_iterator import LastBatchPolicy
from nose import SkipTest
from nose_utils 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
5 changes: 2 additions & 3 deletions dali/test/python/decoder/test_imgcodec.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from test_utils import get_arch
from test_utils import dump_as_core_artifacts
from nose2.tools import params
from nose import SkipTest
from nose_utils import SkipTest


def get_img_files(data_path, subdir="*", ext=None):
Expand Down Expand Up @@ -280,9 +280,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
2 changes: 1 addition & 1 deletion dali/test/python/decoder/test_jpeg_scan_limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from nvidia.dali import pipeline_def

from nose_utils import assert_raises
from nose.plugins.attrib import attr
from nose_utils import attr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can merge it with the above.

from nose2.tools import cartesian_params


Expand Down
4 changes: 2 additions & 2 deletions dali/test/python/decoder/test_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
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 SkipTest
from nose_utils import attr
from nose_utils import assert_raises
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can merge it with the above.



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
2 changes: 1 addition & 1 deletion dali/test/python/operator_1/test_arithmetic_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
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
from nose2.tools import params
import itertools

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
2 changes: 1 addition & 1 deletion dali/test/python/operator_1/test_gaussian_blur.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from scipy.ndimage import convolve1d
import os
from nose_utils import assert_raises, raises
from nose.plugins.attrib import attr
from nose_utils import attr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can merge it with the above.


from sequences_test_utils import video_suite_helper, ArgCb
from test_utils import (
Expand Down
2 changes: 1 addition & 1 deletion dali/test/python/operator_1/test_laplacian.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
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 attr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can merge it with the above.


from sequences_test_utils import video_suite_helper, ArgCb
from test_utils import get_dali_extra_path, check_batch, RandomlyShapedDataIterator
Expand Down
2 changes: 1 addition & 1 deletion dali/test/python/operator_1/test_numba_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
)
from nvidia.dali.plugin.numba.fn.experimental import numba_function
from numba import cuda
from nose.plugins.attrib import attr
from nose_utils import attr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can merge it with L22.


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
3 changes: 1 addition & 2 deletions dali/test/python/operator_2/test_random_object_bbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
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
from nose_utils import attr, nottest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be merged with L17



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

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

import numpy as np

Expand Down
2 changes: 1 addition & 1 deletion dali/test/python/reader/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from test_utils import compare_pipelines, get_dali_extra_path
from nose_utils import assert_raises, raises
from nose2.tools import cartesian_params
from nose import SkipTest
from nose_utils import SkipTest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be merged with L24



def skip_second(src, dst):
Expand Down
2 changes: 1 addition & 1 deletion dali/test/python/reader/test_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import random
import tempfile
from nose_utils import assert_raises
from nose import SkipTest
from nose_utils import SkipTest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can merge it with the above.

from nose2.tools import params, cartesian_params
from test_utils import compare_pipelines, to_array

Expand Down
2 changes: 1 addition & 1 deletion dali/test/python/test_backend_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import nvidia.dali as dali

from nose_utils import assert_raises
from nose import SkipTest
from nose_utils import SkipTest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can merge it with the above and below.

from test_utils import dali_type_to_np, py_buffer_from_address, get_device_memory_info


Expand Down
3 changes: 1 addition & 2 deletions dali/test/python/test_dali_cpu_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
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
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
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
2 changes: 1 addition & 1 deletion dali/test/python/test_dali_tf_dataset_mnist_eager.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
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 nose_utils import SkipTest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can merge it with the above.

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
4 changes: 1 addition & 3 deletions dali/test/python/test_dali_variable_batch_size.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
import random
import re
from functools import partial
from nose_utils import SkipTest
from nose.plugins.attrib import attr
from nose.tools import nottest
from nose_utils import SkipTest, attr, nottest
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
Expand Down
2 changes: 1 addition & 1 deletion dali/test/python/test_external_source_cupy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from nose.plugins.attrib import attr
from nose_utils import attr

# it is enough to just import all functions from test_internals_operator_external_source
# nose will query for the methods available and will run them
Expand Down
2 changes: 1 addition & 1 deletion dali/test/python/test_external_source_impl_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from nvidia.dali import tensors, pipeline_def
import nvidia.dali.fn as fn
from nose_utils import raises, assert_equals
from nose.plugins.attrib import attr
from nose_utils import attr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can merge it with the above.

import numpy as np


Expand Down
2 changes: 1 addition & 1 deletion dali/test/python/test_external_source_pytorch_gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# so it is better to store everything in one file and just call `use_cupy`
# to switch between the default numpy and cupy

from nose.plugins.attrib import attr
from nose_utils import attr
from nvidia.dali.pipeline import Pipeline
import nvidia.dali.fn as fn
from test_utils import check_output
Expand Down
2 changes: 1 addition & 1 deletion dali/test/python/test_functional_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from nose_utils import assert_raises
import sys
import inspect
from nose.plugins.attrib import attr
from nose_utils import attr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be merged with L20

import nose


Expand Down
4 changes: 1 addition & 3 deletions dali/test/python/test_fw_iterators.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@
import numpy as np
import os
from test_utils import get_dali_extra_path
from nose.tools import nottest
from nose_utils import raises, assert_raises
from nose_utils import raises, assert_raises, nottest, attr
from nose2.tools import params
from nose.plugins.attrib import attr
from nvidia.dali.plugin.base_iterator import LastBatchPolicy as LastBatchPolicy
import random

Expand Down
2 changes: 1 addition & 1 deletion dali/test/python/test_optical_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
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 import SkipTest
from nose_utils import SkipTest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can merge it with the above.


test_data_root = get_dali_extra_path()
images_dir = os.path.join(test_data_root, "db", "imgproc")
Expand Down
4 changes: 1 addition & 3 deletions dali/test/python/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@
get_dali_extra_path,
RandomDataIterator,
)
from nose_utils import raises
from nose_utils import assert_raises
from nose.plugins.skip import SkipTest
from nose_utils import raises, assert_raises, SkipTest

test_data_root = get_dali_extra_path()
caffe_db_folder = os.path.join(test_data_root, "db", "lmdb")
Expand Down
2 changes: 1 addition & 1 deletion dali/test/python/test_pipeline_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import numpy as np
import os
from nose.plugins.attrib import attr
from nose_utils import attr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be merged with L23 and L25


from nvidia.dali import fn
from nvidia.dali import tensors
Expand Down
3 changes: 1 addition & 2 deletions dali/test/python/test_pipeline_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

from nvidia.dali import Pipeline, pipeline_def
from nvidia.dali.pipeline import do_not_convert
from nose.tools import nottest
from nose_utils import raises, assert_raises
from nose_utils import raises, assert_raises, nottest
import nvidia.dali.fn as fn
from test_utils import get_dali_extra_path, compare_pipelines
import os
Expand Down
2 changes: 1 addition & 1 deletion dali/test/python/test_pipeline_inputs.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
from nose.plugins.attrib import attr
from nose_utils import attr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be merged with L24

from nose2.tools import params
from numpy.random import default_rng
from nvidia.dali import pipeline_def
Expand Down
2 changes: 1 addition & 1 deletion dali/test/python/test_torch_pipeline_rnnt.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import math
import random
import os
from nose.tools import nottest
from nose_utils import nottest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be moved to L15


# Filtering librispeech samples
audio_files = get_files("db/audio/wav", "wav")
Expand Down
2 changes: 1 addition & 1 deletion dali/test/python/test_utils_tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import os
import tensorflow as tf
from contextlib import contextmanager
from nose import SkipTest
from nose_utils import SkipTest
from nvidia.dali.pipeline import Pipeline
from tensorflow.python.client import device_lib

Expand Down
Loading
Loading