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

Fix nose imports #5698

merged 4 commits into from
Nov 5, 2024

Conversation

mzient
Copy link
Contributor

@mzient mzient commented Nov 4, 2024

Category:

Bug fix (non-breaking change which fixes an issue)

Description:

We need to import nose_utils before anything directly using nose in Python 3.12.
Since Python 3.12 is not tested at pre-merge, it was easy to miss.
This PR replaces all direct imports of nose, nose.tool, nose.plugins, etc. so there's no bad example to copy from.

Additional information:

Affected modules and functionalities:

Key points relevant for the review:

Tests:

  • Existing tests apply
  • New tests added
    • Python tests
    • GTests
    • Benchmark
    • Other
  • N/A

Checklist

Documentation

  • Existing documentation applies
  • Documentation updated
    • Docstring
    • Doxygen
    • RST
    • Jupyter
    • Other
  • N/A

DALI team only

Requirements

  • Implements new requirements
  • Affects existing requirements
  • N/A

REQ IDs: N/A

JIRA TASK: N/A

Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
dali/test/python/nose_utils.py Dismissed Show dismissed Hide dismissed
dali/test/python/nose_utils.py Dismissed Show dismissed Hide dismissed
@@ -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.

@@ -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.

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [20053934]: BUILD STARTED

@@ -28,7 +28,7 @@
)
from nose2.tools import params, cartesian_params
from nose_utils import assert_raises, SkipTest
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.

@@ -279,7 +279,7 @@ 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
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.

I would move this to the beginning of the file.

@@ -280,7 +280,7 @@ 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
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.

I think it can be removed here as is duplicates L32.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True.

@@ -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 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.

@@ -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.

@@ -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.

@@ -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.

@@ -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

@@ -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

@@ -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.

@@ -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.

@@ -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

@@ -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.

@@ -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

@@ -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

Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
@@ -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

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [20054170]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [20054170]: BUILD FAILED

Signed-off-by: Michal Zientkiewicz <michalz@nvidia.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [20055387]: BUILD STARTED

@mzient mzient assigned JanuszL and unassigned stiepan Nov 4, 2024
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [20055387]: BUILD PASSED

@mzient mzient merged commit abde033 into NVIDIA:main Nov 5, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants