mozfile.NamedTemporaryFile API updates

RESOLVED FIXED

Status

RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: k0scist, Assigned: k0scist)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

5 years ago
From https://bugzilla.mozilla.org/show_bug.cgi?id=790765#c35 and
https://bugzilla.mozilla.org/show_bug.cgi?id=790765#c36 :

New file APIs are needed for mozfile.NamedTemporaryFile:

  - should be (line) iterable (i.e. a generator with __iter__ and next
    in the ususal way

  - should take delete=False

Relevent tracebacks:

======================================================================
ERROR: test_schema_version (bug785146.PermissionsTest)
----------------------------------------------------------------------
Traceback (most recent call last): File
"/home/jhammel/mozilla/src/mozilla-central/testing/mozbase/mozprofile/tests/bug785146.py",
line 41, in test_schema_version perms.write_db(self.locations_file)
File
"/home/jhammel/mozilla/src/mozilla-central/testing/mozbase/mozprofile/mozprofile/permissions.py",
line 247, in write_db for location in locations: TypeError:
'NamedTemporaryFile' object is not iterable
----------------------------------------------------------------------

======================================================================
ERROR: test_prefs_write (test_preferences.PreferencesTest) test that
the Preferences.write() method correctly serializes preferences
----------------------------------------------------------------------
Traceback (most recent call last): File
"/home/jhammel/mozilla/src/mozilla-central/testing/mozbase/mozprofile/tests/test_preferences.py",
line 237, in test_prefs_write with
mozfile.NamedTemporaryFile(suffix='.js', delete=False) as f:
TypeError: __init__() got an unexpected keyword argument 'delete'
(Assignee)

Updated

5 years ago
Blocks: 790765
(Assignee)

Comment 1

5 years ago
Following this (and ensuring m-c is okay) this should be version bumped and mirrored to m-c for bug 790765
(Assignee)

Comment 2

5 years ago
Found https://bugzilla.mozilla.org/show_bug.cgi?id=872230 while working.  Luckily, I don't think we care about it for this bug.
(Assignee)

Comment 3

5 years ago
Created attachment 749497 [details] [diff] [review]
fix these things

a version bump and mirroring (possibly to be done with other code) is still needed following checkin
Attachment #749497 - Flags: review?(jgriffin)
(Assignee)

Updated

5 years ago
Assignee: nobody → jhammel
(Assignee)

Updated

5 years ago
Blocks: 872285
Comment on attachment 749497 [details] [diff] [review]
fix these things

Review of attachment 749497 [details] [diff] [review]:
-----------------------------------------------------------------

cool, lgtm!
Attachment #749497 - Flags: review?(jgriffin) → review+
(Assignee)

Comment 5

5 years ago
pushed https://github.com/mozilla/mozbase/commit/a1a7296371692e1ba765a8c4037e97e6807a47a1
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
(Assignee)

Comment 6

5 years ago
Will bump mozfile -> 0.7 for this
You need to log in before you can comment on or make changes to this bug.