Ticket #5916 enhancement closed fixed

Opened 9 months ago

Last modified 9 months ago

Port twisted.python.deprecate to Python 3

Reported by: exarkun Owned by: exarkun
Priority: normal Milestone: Python 3.3 Minimal
Component: core Keywords:
Cc: Branch: branches/deprecate-python3-5916-3
Author: exarkun Launchpad Bug:

Description (last modified by exarkun) (diff)

This is needed by SynchronousTestCase to implement the assertWarns functionality. Specifically, trial uses:

  • deprecated
  • getDeprecationWarningString
  • warnAboutFunction
  • deprecatedModuleAttribute

However, the last two are only used to warn about deprecated functionality, so we can probably skip them and remove that deprecated functionality instead.

Change History

1

Changed 9 months ago by exarkun

  • description modified (diff)

2

Changed 9 months ago by exarkun

  • branch set to branches/deprecate-python3-5916-2
  • branch_author set to exarkun

(In [35432]) Branching to 'deprecate-python3-5916-2'

3

Changed 9 months ago by exarkun

  • description modified (diff)

4

Changed 9 months ago by exarkun

(In [35433]) Port some parts of twisted.python.deprecate that trial really wants

refs #5916

5

Changed 9 months ago by exarkun

  • keywords review added
  • owner changed from exarkun to itamar
  1. Moved tests for deprecated and getVersionString and getDeprecationWarningString into twisted/python/test/test_deprecatepy3.py
  2. Changed some strings in those tests which depend on the module in which the code is defined.
  3. Changed one test using assertWarns to use warnings.catch_warnings instead.
  4. Moved implementation of those methods into twisted/python/_deprecatepy3.py
  5. Also moved _fullyQualifiedName and changed its method handling around a little to work with Python 3.3 changes (should really do this in a separate branch, but waiting for other reflect changes to land first).

Tested locally, but didn't force a build yet, buildbot is too busy.

6

Changed 9 months ago by exarkun

(In [35442]) Filename can be pyc. refs #5916

7

Changed 9 months ago by exarkun

  • branch changed from branches/deprecate-python3-5916-2 to branches/deprecate-python3-5916-3

(In [35443]) Branching to 'deprecate-python3-5916-3'

8

Changed 9 months ago by exarkun

(In [35445]) Move the fullyQualifiedName tests into test_reflectpy3; adjust them to work in that position. Fix a couple more Python 3 incompatibilities in that function.

refs #5916

9

Changed 9 months ago by exarkun

Okay, since #5914 landed, I did the fullyQualifiedName tests properly. In addition to the list of things I mentioned above, the branch now moves the fullyQualifiedName tests into test_reflectpy3.py, adjusts them to use available names (it imports a lot of random extra names; the specific names are not relevant, just the kind of objects they refer to), and fixes another couple bugs in the fullyQualifiedName port.

10

Changed 9 months ago by exarkun

11

Changed 9 months ago by exarkun

(In [35447]) Either side can be a pyc

refs #5916

12

Changed 9 months ago by itamar

  • owner changed from itamar to exarkun
  • keywords review removed
  1. The test that compares reflect to "twisted.python._reflectpy3" and says it's a trick is bad. Either compare _reflectpy3 (you can reimport it) or just do compat.
  2. I don't understand the line at top of test_reflectpy3 module about how the function should be imported from reflect.
  3. Add __future__ imports.

Please fix the above, then merge.

13

Changed 9 months ago by exarkun

(In [35457]) Improve the comment about the _fullyQualifiedName import. Also remove the tricky test, which is redundant anyway.

refs #5916

14

Changed 9 months ago by exarkun

(In [35458]) Add future imports

refs #5916

15

Changed 9 months ago by exarkun

  • status changed from new to closed
  • resolution set to fixed

(In [35459]) Merge deprecate-python3-5916-3

Author: exarkun Reviewer: itamar Fixes: #5916

Port parts of twisted.python.deprecation to Python 3. The parts ported are the parts needed by trial to implement its warning-related APIs.

Note: See TracTickets for help on using tickets.