Closed Bug 1193328 Opened 9 years ago Closed 9 years ago

remove eq_ and ok_: redirector

Categories

(Input Graveyard :: Code Quality, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: willkg, Assigned: reachtotj, Mentored)

References

Details

We recently switched from nose to py.test. nose had helper functions eq_ and ok_ which we used extensively throughout the test suite. py.test doesn't need these since it does magic things with assert.

This bug covers removing eq_ and ok_ usage and replacing them with normal asserts in the fjord/redirector/ directory.
Required skills:

* experience with Python
* ability to run the test suite

How to implement:

For each file in fjord/*/tests/, do the following:

1. remove eq_ and ok_ from the import list
2. go through the file converting eq_ and ok_ to appropriate assert lines

An eq_ example:

    eq_(resp.status_code, 200)

This line verifies that the value of resp.status_code is 200. The equivalent assert statement is:

    assert resp.status_code == 200

An ok_ example:

    ok_(user.is_admin())

This line verifies that the value returned by the call user.is_admin() is True. The equivalent assert statement is:

    assert user.is_admin()

You can read up on assert in the py.test docs:

    http://pytest.org/latest/assert.html

I did the work for fjord/alerts/. You can see the commit here:

    https://github.com/mozilla/fjord/commit/37cb87734570f15818061ac291f750931c896842


Marking this as a mentored bug. If you're interested in working on it,
please read through our "Join this project" guide [1], complete the
list of things you need to do before contributing and then add a comment
to this bug asking to have it assigned to you.

If you have any questions, please ask on the mailing list or in the
#input channel on irc.mozilla.org.

[1] http://fjord.readthedocs.org/en/latest/welcome.html
Mentor: willkg
Assigning these all to reachtotj since he's cruised through the last couple.
Assignee: nobody → reachtotj
In a PR: https://github.com/mozilla/fjord/pull/649

Landed in master: https://github.com/mozilla/fjord/commit/bd4c4e7b64c6a365179022d83ff5ae2452a61f22

This only touched tests, so there's nothing to deploy. Marking as FIXED.

Thank you!
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Product: Input → Input Graveyard
You need to log in before you can comment on or make changes to this bug.