-
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
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 <[email protected]>
Greptile SummaryThis PR completes the migration from nose to nose2 as the exclusive testing framework. The changes remove Python 3.12+ compatibility workarounds that were needed for the deprecated nose package. Key Changes:
Impact: Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant TestScript as Test Script (*.sh)
participant Nose2 as Nose2 Runner
participant NoseUtils as nose_utils.py
participant TestFile as Test Files (*.py)
participant Unittest as Python unittest
TestScript->>Nose2: Execute with -A attribute filter
Note over TestScript,Nose2: Changed from --attr to -A<br/>Changed from -m regex to -A attributes<br/>Removed .py extension from test names
Nose2->>TestFile: Discover tests with @attr decorators
TestFile->>NoseUtils: Import compatibility decorators
Note over NoseUtils: Provides backward-compatible<br/>decorators for nose migration:<br/>- with_setup/with_teardown<br/>- attr<br/>- nottest<br/>- assert_raises/assert_warns
NoseUtils->>Unittest: Use unittest assertions
Note over NoseUtils,Unittest: Direct unittest usage instead<br/>of nose.tools
TestFile->>Nose2: Execute test with setup/teardown
Nose2->>Unittest: Run assertions
Unittest-->>Nose2: Return results
Nose2-->>TestScript: Return test results
|
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
Signed-off-by: Krzysztof Lecki <[email protected]>
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
Signed-off-by: Krzysztof Lecki <[email protected]>
Signed-off-by: Krzysztof Lecki <[email protected]>
Signed-off-by: Krzysztof Lecki <[email protected]>
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 |
Signed-off-by: Krzysztof Lecki <[email protected]>
|
!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 |
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