#11284 closed enhancement (fixed)
Replace deprecated unittest method aliases — at Version 7
Reported by: | Ryan J Ollos | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.0.2 |
Component: | general | Version: | 1.0-stable |
Severity: | normal | Keywords: | unit tests |
Cc: | Branch: | ||
Release Notes: |
Replaced deprecated unit test method aliases, and refactored tests to utilize new methods in |
||
API Changes: |
The |
||
Internal Changes: |
Description
Several unittest method aliases are deprecated since Python 2.7. Although it is not necessary to make the changes now, it seems like a good step toward making the codebase more readable, and better to make all the changes at once.
Change History (7)
follow-up: 3 comment:2 by , 11 years ago
Additionally, it would be good to add trac.tests.compat
module rather than adding test functions in each testcase class. The module provides test functions since 2.7 for backwards-compatibility with 2.5-2.6. The changes is in [f8a7f571/jomae.git].
comment:3 by , 11 years ago
Replying to jomae:
… The changes is in [f8a7f571/jomae.git].
That looks great! I was hoping there was a nice way to accomplish that without subclassing unittest.TestCase
, but I didn't see the way until you showed me.
If you decide to push those change to the trunk soon that would work fine, otherwise I can push them after I finish refactoring some of the unit tests this coming weekend.
comment:4 by , 11 years ago
Not sure what is going on yet, but trac.mimeview.tests.pygments
can't be executed in isolation:
user@ubuntu:~/Workspace/trac-1.0-stable$ PYTHONPATH=. python trac/mimeview/tests/pygments.py Traceback (most recent call last): File "trac/mimeview/tests/pygments.py", line 21, in <module> pygments = __import__('pygments', {}, {}, []) File "/home/user/Workspace/trac-1.0-stable/trac/mimeview/tests/pygments.py", line 28, in <module> from trac.mimeview.pygments import PygmentsRenderer File "/home/user/Workspace/trac-1.0-stable/trac/mimeview/pygments.py", line 35, in <module> get_all_lexers = pygments.lexers.get_all_lexers AttributeError: 'module' object has no attribute 'lexers'
follow-up: 6 comment:5 by , 11 years ago
Latest proposed changes can be found in rjollos.git:t11284.2.
comment:6 by , 11 years ago
Replying to rjollos:
Not sure what is going on yet, but
trac.mimeview.tests.pygments
can't be executed in isolation:
Try like this:
$ PYTHONPATH=. ~/venv/py25/bin/python -m trac.mimeview.tests.pygments ..... ---------------------------------------------------------------------- Ran 5 tests in 0.427s OK
Replying to rjollos:
Latest proposed changes can be found in rjollos.git:t11284.2.
LGTM, verified with Python 2.5-2.7.
comment:7 by , 11 years ago
API Changes: | modified (diff) |
---|---|
Milestone: | → 1.0.2 |
Priority: | normal → low |
Release Notes: | modified (diff) |
Resolution: | → fixed |
Status: | new → closed |
Committed to 1.0-stable in [12070:12079] and merged to trunk in [12080].
Changes prepared in rjollos.git:t11284. I'll probably make another pass through and try to clean up some of the logic, like what was done in 237f3ea8/rjollos.git.