Closed Bug 603012 Opened 14 years ago Closed 14 years ago

buildbotcustom process.factory.UnittestPackagedBuildFactory uses env=None as a default argument which does not work

Categories

(Release Engineering :: General, defect, P4)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: k0scist, Assigned: lsblakk)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch + self.env.update(env or {}) (obsolete) — Splinter Review
Currently, UnittestPackagedBuildFactory uses the default argument `env=None`.  However, this will fail on `self.env.update(env)` in `__init__`.  This should be made `self.env.update(env or None)` or similar, or, if it is not desirable, then `env` should not be given a default argument in the function argspec.
Patch attached.
Do you have an example of this "not working" somewhere?  http://hg.mozilla.org/build/buildbotcustom/file/0c2a2d85b511/process/factory.py#l6624 shows that we copy in the env from http://hg.mozilla.org/build/buildbotcustom/file/0c2a2d85b511/env.py first, then update with any custom env passed in to UnittestPackagedBuildFactory (with env=None in case nothing custom is passed in).

Since self.env is set before self.env.update(env) is called, I'm not sure how your patch is adding value here.  An example would be useful.
Without the patch the following will not work:

"""
from buildbotcustom.process.factory import *

# define builder factory                                                        
f1 = UnittestPackagedBuildFactory(platform='linux',
                                  hgHost='hg.mozilla.org/',
                                  buildToolsRepoPath='build/tools',
                                  repoPath='mozilla-central',
                                  productName='firefox',
                                  test_suites=['reftest'])
"""

Since env is given a default value in the initializer, it *should* work.  The patch does no harm (if an env is given, then it will be used), so should be applied.  Alternatively, you could remove env=None in the constructor arglist and just pass env.

In any case, I see no downside to fixing this.
Assignee: nobody → lsblakk
Priority: -- → P4
taking out env=None, also audited misc.py for calls to UnittestPackagedBuildFactory and added the passing of env to the non-chunks version of CCTest so it matches the chunks version.  Ran test-masters on it, passed.
Attachment #481960 - Attachment is obsolete: true
Attachment #483664 - Flags: review?(bhearsum)
Attachment #483664 - Flags: review?(bhearsum) → review+
Flags: needs-reconfig?
Comment on attachment 483664 [details] [diff] [review]
make env a required arg in UnittestPackagedBuildFactory

http://hg.mozilla.org/build/buildbotcustom/rev/72f43b066ce8
Attachment #483664 - Flags: checked-in+
Status: NEW → RESOLVED
Closed: 14 years ago
Flags: needs-reconfig?
Resolution: --- → FIXED
Product: mozilla.org → Release Engineering
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: