chipx86 got a fish trophy!
Move away from most fixtures for the webapi tests.
Review Request #4554 — Created Sept. 10, 2013 and submitted
Move away from most fixtures for the webapi tests.
This removes the usage of the test_reviewrequests and most of the
test_scmtools fixtures from the webapi unit tests. Instead, these test
suites now use the new TestCase class's utility methods for creating
test objects.It also removes a lot of the older utility methods for creating dummy
objects that went through the API. Each of these requests contributed
50-100ms of time, which added up.With the test suite as it originally was, on my machine, it took roughly
159 seconds to complete. After this and the previous changes, it drops
to around ~88.Unit tests are much clearer now. Instead of having to know how fixtures
are set up, or tracing through a bunch of API requests, you can just
read the unit tests and see what they're doing.In total, 1,823 lines of code have been deleted in these changes.
Unit tests pass.
Compared speeds and saw that tests are down to around 88 lines.
Ran pyflakes.
-
This is a review from Review Bot.
Tool: Pyflakes
Processed Files:
reviewboard/webapi/tests/test_review_reply_screenshot_comment.py
reviewboard/webapi/tests/test_review_screenshot_comment.py
reviewboard/webapi/tests/test_file_diff_comment.py
reviewboard/webapi/tests/test_watched_review_request.py
reviewboard/webapi/tests/test_review.py
reviewboard/webapi/tests/test_default_reviewer.py
reviewboard/webapi/tests/test_draft_review_screenshot_comment.py
reviewboard/webapi/tests/test_screenshot.py
reviewboard/webapi/tests/test_repository_commits.py
reviewboard/webapi/tests/test_review_comment.py
reviewboard/webapi/tests/test_review_group.py
reviewboard/webapi/tests/test_file_attachment_draft.py
reviewboard/webapi/tests/test_change.py
reviewboard/webapi/tests/test_review_reply.py
reviewboard/webapi/tests/test_file_attachment_comment.py
reviewboard/webapi/tests/urls.py
reviewboard/webapi/tests/test_repository_branches.py
reviewboard/webapi/tests/base.py
reviewboard/webapi/tests/test_screenshot_comment.py
reviewboard/webapi/tests/test_watched_review_group.py
reviewboard/webapi/tests/test_review_request.py
reviewboard/webapi/tests/test_review_request_draft.py
reviewboard/webapi/tests/test_draft_review_file_attachment_comment.py
reviewboard/webapi/tests/test_diff.py
reviewboard/webapi/tests/test_repository.py
reviewboard/webapi/tests/test_validate_diff.py
reviewboard/webapi/tests/test_file_attachment.py
reviewboard/webapi/tests/test_review_reply_file_attachment_comment.py
reviewboard/webapi/tests/test_review_group_user.py
reviewboard/webapi/tests/test_repository_info.py
reviewboard/webapi/tests/test_review_reply_diff_comment.py
reviewboard/webapi/tests/test_screenshot_draft.py
Ignored Files:
reviewboard/reviews/fixtures/test_reviewrequests.json
reviewboard/scmtools/fixtures/test_scmtools.json