We do have one class per function *tested*, since I factored all the code. Yes the recent PRs may not follow that convention because of the bad design decision we made with multiple test files with arbitary names and/or because may not all parts where migrated during my last refactoring of the code.

Again I'm talking about one class per function *tested* and not one class per test function. It doens't increase code size and it's way easier to locate what you want.

E.g. tests regarding show() from views.py should live in tests/test_views.py under ShowTests class. 'Funfacts' and 'Announcement' apps are good examples of this practice.

----- Original Message -----
From: "Andrei Hajdukewycz" <notifications@github.com>
To: "mozilla/mozillians" <mozillians@noreply.github.com>
Cc: "Giorgos Logiotatidis" <giorgos@mozilla.com>
Sent: Wednesday, January 29, 2014 7:34:59 PM
Subject: Re: [mozillians] Fix bug 938005 - Display current time in profile user's timezone (#765)

> +        with patch('mozillians.common.helpers.aware_now') as mock_aware_now:
> +            mock_aware_now.return_value = utc_time
> +            result = helpers.now_in_timezone(tz_name)
> +        ok_(is_aware(result))
> +        fmt_time = result.strftime("%H:%M %Z")
> +        eq_('07:04 EST', fmt_time)
> +
> +    def test_offset_of_timezone(self):
> +        # offset_of_timezone returns the offset in minutes of the named timezone as of now
> +        # Construct a time in UTC that will be "now"
> +        utc_time = datetime.datetime(1972, 1, 1, 3, 4, 5).replace(tzinfo=pytz.utc)
> +        tz_name = "US/Eastern"  # 5 hours difference from UTC on 1/1/1972
> +        with patch('mozillians.common.helpers.aware_now') as mock_aware_now:
> +            mock_aware_now.return_value = utc_time
> +            result = helpers.offset_of_timezone(tz_name)
> +        eq_(-300, result)

Since when do we do one class per function? Many recent PRs(including all the groups work, the upcoming language PR, etc) don't follow this convention, and I've never heard of it until this comment. One class per function in tests doesn't seem particularly useful to me(and adds a HUGE amount of extra lines to the test files), do you have some specific reason for requesting this?

---
Reply to this email directly or view it on GitHub:
https://github.com/mozilla/mozillians/pull/765/files#r9275611