suppress DeprecationWarning in tahoe --version output #1129

Closed
opened 2010-07-20 00:43:21 +00:00 by davidsarah · 13 comments
davidsarah commented 2010-07-20 00:43:21 +00:00
Owner

From /tahoe-lafs/trac-2024-07-25/issues/8627#comment:120406 :

% bin/tahoe --version
/usr/lib/python2.6/dist-packages/Pyrex/Compiler/Errors.py:17: 
DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
  self.message = message
allmydata-tahoe: 1.7.0-r4536, foolscap: 0.5.1, pycryptopp: 0.5.19, zfec: 1.4.7, 
Twisted: 8.2.0, Nevow: 0.9.33-r17222, zope.interface: 3.5.1, python: 2.6.2, 
platform: Linux-Ubuntu_9.04-i686-32bit_ELF, sqlite: 3.6.21, simplejson: 2.0.9, 
argparse: 1.1, pycrypto: 2.0.1, pyOpenSSL: 0.7, pyutil: 1.7.9, zbase32: 1.1.2, 
setuptools: 0.6c15dev, pyasn1: 0.0.11a, pysqlite: 2.4.1

The DeprecationWarning should have been suppressed.

From [/tahoe-lafs/trac-2024-07-25/issues/8627](/tahoe-lafs/trac-2024-07-25/issues/8627)#[comment:120406](/tahoe-lafs/trac-2024-07-25/issues/1129#issuecomment-120406) : ``` % bin/tahoe --version /usr/lib/python2.6/dist-packages/Pyrex/Compiler/Errors.py:17: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6 self.message = message allmydata-tahoe: 1.7.0-r4536, foolscap: 0.5.1, pycryptopp: 0.5.19, zfec: 1.4.7, Twisted: 8.2.0, Nevow: 0.9.33-r17222, zope.interface: 3.5.1, python: 2.6.2, platform: Linux-Ubuntu_9.04-i686-32bit_ELF, sqlite: 3.6.21, simplejson: 2.0.9, argparse: 1.1, pycrypto: 2.0.1, pyOpenSSL: 0.7, pyutil: 1.7.9, zbase32: 1.1.2, setuptools: 0.6c15dev, pyasn1: 0.0.11a, pysqlite: 2.4.1 ``` The DeprecationWarning should have been suppressed.
tahoe-lafs added the
code
minor
defect
1.7.0
labels 2010-07-20 00:43:21 +00:00
tahoe-lafs added this to the 1.8.0 milestone 2010-07-20 00:43:21 +00:00
davidsarah commented 2010-07-20 00:51:13 +00:00
Author
Owner

source:src/allmydata/init.py contains code that is intended to suppress this warning, but says to do so only when it comes from twisted:

# This warning is generated by twisted, but not when it is imported, only on an error.
warnings.filterwarnings("ignore", category=DeprecationWarning,
    message="BaseException.message has been deprecated as of Python 2.6",
    module=".*twisted.*", append=True)

I think this should just be changed to a global filter, i.e. delete 'module=".*twisted.*", '. This particular deprecation is not important and doesn't ever merit bothering any end-user.

source:src/allmydata/*init*.py contains code that is intended to suppress this warning, but says to do so only when it comes from twisted: ``` # This warning is generated by twisted, but not when it is imported, only on an error. warnings.filterwarnings("ignore", category=DeprecationWarning, message="BaseException.message has been deprecated as of Python 2.6", module=".*twisted.*", append=True) ``` I think this should just be changed to a global filter, i.e. delete '`module=".*twisted.*", `'. This particular deprecation is not important and doesn't ever merit bothering any end-user.
tahoe-lafs added
code-frontend-cli
and removed
code
labels 2010-07-20 00:51:13 +00:00
tahoe-lafs modified the milestone from 1.8.0 to 1.8β 2010-07-20 00:51:13 +00:00
davidsarah commented 2010-07-20 01:00:54 +00:00
Author
Owner

Attachment silence-basexception-warning.dpatch (1169 bytes) added

init.py: silence DeprecationWarning about BaseException.message globally.

**Attachment** silence-basexception-warning.dpatch (1169 bytes) added *init*.py: silence [DeprecationWarning](wiki/DeprecationWarning) about [BaseException](wiki/BaseException).message globally.
davidsarah commented 2010-07-20 01:02:43 +00:00
Author
Owner

(That attachment description should say *init*.py.)

(That attachment description should say `*init*.py`.)
tahoe-lafs added
code
and removed
code-frontend-cli
labels 2010-07-20 01:02:43 +00:00
davidsarah commented 2010-07-20 01:28:52 +00:00
Author
Owner

Attachment test-tahoe-version-no-warning.dpatch (1909 bytes) added

test_runner: test that 'tahoe --version' outputs no noise (e.g. DeprecationWarnings).

**Attachment** test-tahoe-version-no-warning.dpatch (1909 bytes) added test_runner: test that 'tahoe --version' outputs no noise (e.g. [DeprecationWarnings](wiki/DeprecationWarnings)).
zooko commented 2010-07-20 01:29:25 +00:00
Author
Owner

reviewed. +1. (I suggest that you darcs amend --edit the patch to append "fixes #1129" to it, and if you don't do so soon then I will.)

reviewed. +1. (I suggest that you `darcs amend --edit` the patch to append "fixes #1129" to it, and if you don't do so soon then I will.)
david-sarah@jacaranda.org commented 2010-07-20 01:35:27 +00:00
Author
Owner

In changeset:94bec75ddaddaaf5:

__init__.py: silence DeprecationWarning about BaseException.message globally. fixes #1129
In changeset:94bec75ddaddaaf5: ``` __init__.py: silence DeprecationWarning about BaseException.message globally. fixes #1129 ```
tahoe-lafs added the
fixed
label 2010-07-20 01:35:27 +00:00
david-sarah@jacaranda.org closed this issue 2010-07-20 01:35:27 +00:00
davidsarah commented 2010-07-20 01:43:01 +00:00
Author
Owner

Hmm, actually the output in the description shows that the version of twisted is 8.2.0, so the unit test will be skipped (this matches the existing test_client_no_noise in test_runner.py, but the latter is also skipped on platforms where we can't daemonize).

Is the test valid when Twisted < 8.2.0 Twisted < 9.0.0, or will it give false-alarms?

Hmm, actually the output in the description shows that the version of twisted is 8.2.0, so the unit test will be skipped (this matches the existing `test_client_no_noise` in `test_runner.py`, but the latter is *also* skipped on platforms where we can't daemonize). Is the test valid when ~~Twisted < 8.2.0~~ Twisted < 9.0.0, or will it give false-alarms?
zooko commented 2010-07-20 04:13:03 +00:00
Author
Owner

Sorry, I don't understand the question(s) in comment:120413.

Sorry, I don't understand the question(s) in [comment:120413](/tahoe-lafs/trac-2024-07-25/issues/1129#issuecomment-120413).
davidsarah commented 2010-07-20 05:59:09 +00:00
Author
Owner

Replying to zooko:

Sorry, I don't understand the question(s) in comment:120413.

The [new test]source:src/allmydata/test/test_runner.py@4581#L51 is skipped if the Twisted version < 9.0.0. That's copying the skip condition in [test_client_no_noise]source:src/allmydata/test/test_runner.py@4581#L376. (The new test is not redundant with test_client_no_noise, because it can be run on Windows and the latter can't, and because it's testing a different command.)

I was wondering whether this skip is actually necessary. It might not be, since tahoe --version doesn't need to import very much of twisted.

Replying to [zooko](/tahoe-lafs/trac-2024-07-25/issues/1129#issuecomment-120414): > Sorry, I don't understand the question(s) in [comment:120413](/tahoe-lafs/trac-2024-07-25/issues/1129#issuecomment-120413). The [new test]source:src/allmydata/test/test_runner.py@4581#L51 is skipped if the Twisted version < 9.0.0. That's copying the skip condition in [test_client_no_noise]source:src/allmydata/test/test_runner.py@4581#L376. (The new test is not redundant with test_client_no_noise, because it can be run on Windows and the latter can't, and because it's testing a different command.) I was wondering whether this skip is actually necessary. It might not be, since `tahoe --version` doesn't need to import very much of twisted.
zooko commented 2010-07-21 17:11:20 +00:00
Author
Owner

I don't know, but I don't mind skipping the test when Twisted < 9.

I don't know, but I don't mind skipping the test when Twisted < 9.
davidsarah commented 2010-07-22 05:21:39 +00:00
Author
Owner

Replying to zooko:

I don't know, but I don't mind skipping the test when Twisted < 9.

OK, so the fix in changeset:94bec75ddaddaaf5 is sufficient.

Replying to [zooko](/tahoe-lafs/trac-2024-07-25/issues/1129#issuecomment-120416): > I don't know, but I don't mind skipping the test when Twisted < 9. OK, so the fix in changeset:94bec75ddaddaaf5 is sufficient.
david-sarah@jacaranda.org commented 2010-10-26 01:31:34 +00:00
Author
Owner

In changeset:59e80b2ec92928bf:

test_mutable.py: add test for ResponseCache memory leak. refs #1045, #1129
In changeset:59e80b2ec92928bf: ``` test_mutable.py: add test for ResponseCache memory leak. refs #1045, #1129 ```
davidsarah commented 2010-10-26 01:41:56 +00:00
Author
Owner

Replying to david-sarah@…:

In changeset:59e80b2ec92928bf:

#CommitTicketReference repository="trunk" revision="4762"
test_mutable.py: add test for [ResponseCache](wiki/ResponseCache) memory leak. refs #1045, #1129

Typo in commit message; this should have referred to #1229.

Replying to [david-sarah@…](/tahoe-lafs/trac-2024-07-25/issues/1129#issuecomment-120418): > In changeset:59e80b2ec92928bf: > ``` > #CommitTicketReference repository="trunk" revision="4762" > test_mutable.py: add test for [ResponseCache](wiki/ResponseCache) memory leak. refs #1045, #1129 > ``` Typo in commit message; this should have referred to #1229.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: tahoe-lafs/trac-2024-07-25#1129
No description provided.