-
-
Notifications
You must be signed in to change notification settings - Fork 415
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 issue in utils.progress for disable=True #5964
Conversation
@DragaDoncila here's the PR for #5961 |
Codecov Report
@@ Coverage Diff @@
## main #5964 +/- ##
==========================================
- Coverage 90.19% 90.19% -0.01%
==========================================
Files 615 615
Lines 52039 52045 +6
==========================================
+ Hits 46939 46942 +3
- Misses 5100 5103 +3
|
Could you add test? It looks like a nice thing to backport to 0.4.18 but I will appreciate tests for any such thing to not need manually test it. |
Are there any tests for the progressbar already where I could just add this one, @Czaki ? |
@constantinpape looks like here would work?
Also, before this is merged, could you just ensure the PR description is self-sufficient, rather than the See Issue...? |
for more information, see https://pre-commit.ci
I have added a test now and updated the PR description. |
Maybe the reproducer and error (which are in the issue) could be replaced with something like:
(if i'm getting the nature of the change correctly from the code and comment) |
@constantinpape There is a need to update the test as they are failing. |
Co-authored-by: Peter Sobolewski <76622105+psobolewskiPhD@users.noreply.github.com>
Thanks for fixing the tests @psobolewskiPhD. This is good to go from my side now. |
@constantinpape as it is your first contribution to napari, and it will be backported to 0.4.18. Could you provide data to be put in https://github.com/napari/napari/blob/main/CITATION.cff ? |
I have added the citation info in 2ac73e0. |
PR Test / ubuntu-latest 3.9 pyside6 (pull_request) is timing out. This seems to be unrelated to the changes here. |
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.
Thank you for the contribution @constantinpape! 🎉
# Fixes/Closes Closes #5961 # Description and references This PR changes the `progress.__init__` such that if the progress bar is disabled, the 'desc' property is set to a dummy value, because otherwise it is not set by the tqdm super constructor and throws an error. ## Type of change - [x] Bug-fix (non-breaking change which fixes an issue) # How has this been tested? A test `test_progress_set_disable` has been added to napari/utils/_tests/test_progress.py I checked locally that this test fixes this code: ```python # from tqdm import tqdm from napari.utils import progress as tqdm for z in tqdm(range(10), total=10, desc="Count to 10", disable=True): pass ``` which throws an `AttributeError` without the fix. ## Final checklist: - [x] My PR is the minimum possible work for the desired functionality - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have added tests that prove my fix is effective or that my feature works --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Peter Sobolewski <76622105+psobolewskiPhD@users.noreply.github.com>
# Fixes/Closes Closes #5961 # Description and references This PR changes the `progress.__init__` such that if the progress bar is disabled, the 'desc' property is set to a dummy value, because otherwise it is not set by the tqdm super constructor and throws an error. ## Type of change - [x] Bug-fix (non-breaking change which fixes an issue) # How has this been tested? A test `test_progress_set_disable` has been added to napari/utils/_tests/test_progress.py I checked locally that this test fixes this code: ```python # from tqdm import tqdm from napari.utils import progress as tqdm for z in tqdm(range(10), total=10, desc="Count to 10", disable=True): pass ``` which throws an `AttributeError` without the fix. ## Final checklist: - [x] My PR is the minimum possible work for the desired functionality - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have added tests that prove my fix is effective or that my feature works --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Peter Sobolewski <76622105+psobolewskiPhD@users.noreply.github.com>
# Fixes/Closes Closes #5961 # Description and references This PR changes the `progress.__init__` such that if the progress bar is disabled, the 'desc' property is set to a dummy value, because otherwise it is not set by the tqdm super constructor and throws an error. ## Type of change - [x] Bug-fix (non-breaking change which fixes an issue) # How has this been tested? A test `test_progress_set_disable` has been added to napari/utils/_tests/test_progress.py I checked locally that this test fixes this code: ```python # from tqdm import tqdm from napari.utils import progress as tqdm for z in tqdm(range(10), total=10, desc="Count to 10", disable=True): pass ``` which throws an `AttributeError` without the fix. ## Final checklist: - [x] My PR is the minimum possible work for the desired functionality - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have added tests that prove my fix is effective or that my feature works --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Peter Sobolewski <76622105+psobolewskiPhD@users.noreply.github.com>
# Fixes/Closes Closes #5961 # Description and references This PR changes the `progress.__init__` such that if the progress bar is disabled, the 'desc' property is set to a dummy value, because otherwise it is not set by the tqdm super constructor and throws an error. ## Type of change - [x] Bug-fix (non-breaking change which fixes an issue) # How has this been tested? A test `test_progress_set_disable` has been added to napari/utils/_tests/test_progress.py I checked locally that this test fixes this code: ```python # from tqdm import tqdm from napari.utils import progress as tqdm for z in tqdm(range(10), total=10, desc="Count to 10", disable=True): pass ``` which throws an `AttributeError` without the fix. ## Final checklist: - [x] My PR is the minimum possible work for the desired functionality - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have added tests that prove my fix is effective or that my feature works --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Peter Sobolewski <76622105+psobolewskiPhD@users.noreply.github.com>
# Fixes/Closes Closes napari#5961 # Description and references This PR changes the `progress.__init__` such that if the progress bar is disabled, the 'desc' property is set to a dummy value, because otherwise it is not set by the tqdm super constructor and throws an error. ## Type of change - [x] Bug-fix (non-breaking change which fixes an issue) # How has this been tested? A test `test_progress_set_disable` has been added to napari/utils/_tests/test_progress.py I checked locally that this test fixes this code: ```python # from tqdm import tqdm from napari.utils import progress as tqdm for z in tqdm(range(10), total=10, desc="Count to 10", disable=True): pass ``` which throws an `AttributeError` without the fix. ## Final checklist: - [x] My PR is the minimum possible work for the desired functionality - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have added tests that prove my fix is effective or that my feature works --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Peter Sobolewski <76622105+psobolewskiPhD@users.noreply.github.com>
Fixes/Closes
Closes #5961
Description and references
This PR changes the
progress.__init__
such that if the progress bar is disabled, the 'desc' property is set to a dummy value, because otherwise it is not set by the tqdm super constructor and throws an error.Type of change
How has this been tested?
I checked locally that this test fixes this code:
which throws an
AttributeError
without the fix.Final checklist:
trans.
to make them localizable.For more information see our translations guide.