-
Notifications
You must be signed in to change notification settings - Fork 655
Move to nose2 only #6146
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
base: main
Are you sure you want to change the base?
Move to nose2 only #6146
Conversation
Greptile SummaryThis PR successfully migrates the DALI test suite from the deprecated nose framework to nose2, removing all nose dependencies and compatibility workarounds. Key Changes:
Implementation Quality: Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant TestScript as Test Script (QA)
participant Nose2 as nose2 Runner
participant AttribGen as AttributeGeneratorFilter Plugin
participant AttribPlugin as AttributeSelector Plugin
participant GenPlugin as Generators Plugin
participant TestModule as Test Module
TestScript->>Nose2: python -m nose2 -A 'pytorch' test_module
Nose2->>AttribGen: handleArgs event
AttribGen->>GenPlugin: Monkey-patch _testsFromGeneratorFunc
Note over AttribGen,GenPlugin: Patches before test discovery
Nose2->>TestModule: Discover tests
TestModule->>GenPlugin: Found generator function
GenPlugin->>AttribGen: patched_tests_from_gen(event, obj)
AttribGen->>AttribPlugin: Check if @attr matches filter
alt Attributes match
AttribGen->>GenPlugin: Call original method
GenPlugin->>TestModule: Execute generator, yield test cases
TestModule-->>Nose2: Return test instances
else Attributes don't match
AttribGen-->>GenPlugin: Return empty list
Note over AttribGen,GenPlugin: Skip without executing generator
end
Nose2->>TestModule: Run matched tests
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (1)
-
dali/test/python/nose_utils.py, line 129-130 (link)style: creating a new
TestCaseinstance for each assertion call is unconventionalConsider creating a module-level instance once:
Then define
tcat module level (after imports) and reuse it in bothassert_raisesandassert_warnsNote: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
25 files reviewed, 1 comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (2)
-
dali/test/python/test_functional_api.py, line 22 (link)logic: This file still imports
nosedirectly and usesnose.tools.eq_on line 188. Since nose is being removed as a dependency, this will cause an import error. -
dali/test/python/test_functional_api.py, line 188 (link)logic: Replace
nose.tools.eq_with standard assertion or useassert_equalsfromnose_utilsNote: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
28 files reviewed, 2 comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (1)
-
dali/test/python/nose_utils.py, line 68 (link)syntax: missing
selfparameter - instance methods must haveselfas first parameter
29 files reviewed, 1 comment
|
!build |
|
CI MESSAGE: [40627092]: BUILD STARTED |
|
CI MESSAGE: [40627092]: BUILD FAILED |
|
!build |
|
CI MESSAGE: [40628704]: BUILD STARTED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (1)
-
dali/test/python/nose_utils.py, line 83-85 (link)style: Consider using the module-level
_test_caseinstance instead of creating a newempty_case()for each assertion:This is more efficient and aligns with how
assert_raisesandassert_warnsare implemented.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
29 files reviewed, 1 comment
|
Do we need to touch |
|
CI MESSAGE: [40628704]: BUILD FAILED |
mzient
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way the tests are first discovered and then run will most certainly prevent parallel external source from working (see test job 247483858) was the primary reason for not pursuing full transition to nose2 to date.
Perhaps you can move the troublesome tests to separate files to guarantee proper execution order.
Also, some of the tests used to generate vast amounts of data in the "discovery" stage, because yielding in nose didn't cause data accumulation. Please make sure that this is not the case any more - the tests might work when run one by one but case out-of-memory condition when multiple test files are run.
Remove the WARs used to keep nose alive. nose2 supports the yield-style test discovery by default @attr has a different filtering syntax (`-A`) and just checks for presence of truthy test_foo.attribute_name. A decorator uses this mechanism for backward compatibility. nose2 splits with_setup(setup, teardown) into two separate decorators, a backward compatible decorator is added. nottest sets special attribute. SkipTest from unittest is recommended to be used directly (with the same functionality). Test scripts are adjusted with minimal changes to run through nose2. Followup cleanup can be used for renaming. Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (1)
-
dali/test/python/nose_utils.py, line 74 (link)syntax: Missing
selfparameter in method definition
33 files reviewed, 1 comment
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Greptile's behavior is changing!From now on, if a review finishes with no comments, we will not post an additional "statistics" comment to confirm that our review found nothing to comment on. However, you can confirm that we reviewed your changes in the status check section. This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR". |
|
!build |
|
CI MESSAGE: [40968438]: BUILD STARTED |
|
CI MESSAGE: [40968438]: BUILD FAILED |
Signed-off-by: Krzysztof Lecki <klecki@nvidia.com>
Use nose2 as the only testing framework. Drop nose.
Category: Other
Description:
Remove the WARs used to keep nose alive.
nose2 supports the yield-style test discovery by default @attr has a different filtering syntax (
-A) and just checks for presence of truthy test_foo.attribute_name. A decorator uses this mechanism for backward compatibility.nose2 splits with_setup(setup, teardown) into two separate decorators, a backward compatible decorator is added.
nottest sets special attribute.
SkipTest from unittest is recommended to be used directly (with the same functionality).
Test scripts are adjusted with minimal changes to run through nose2. Followup cleanup can be used for renaming.
Replace unsupported -m regex by attributes
Additional information:
Affected modules and functionalities:
Key points relevant for the review:
Tests:
Checklist
Documentation
DALI team only
Requirements
REQ IDs: N/A
JIRA TASK: N/A