Bug 171268 - Rename MockFileSystem.maybe_make_directory()
Summary: Rename MockFileSystem.maybe_make_directory()
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-25 03:36 PDT by Carlos Alberto Lopez Perez
Modified: 2017-04-25 08:57 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Alberto Lopez Perez 2017-04-25 03:36:15 PDT
The name maybe_make_directory is pretty confusing as it suggest the function may fail to create the directory.

The function is this:


    def maybe_make_directory(self, *path):
        norm_path = self.normpath(self.join(*path))
        while norm_path and not self.isdir(norm_path):
            self.dirs.add(norm_path)
            norm_path = self.dirname(norm_path)

https://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/system/filesystem_mock.py?rev=215715#L279

So I understand it behaves exactly like "mkdir -p"
Comment 1 Michael Catanzaro 2017-04-25 07:29:05 PDT
Hm, this is not what I meant. I assumed it was obvious that maybe_make_directory() functions like "mkdir -p". So I think the current name is fine. But we should have a function that operates like plain "mkdir" so that you can use it in tests in cases where the directory should definitely not already exist, as in bug #168036.

This is very unimportant. :)
Comment 2 Carlos Alberto Lopez Perez 2017-04-25 08:57:30 PDT
(In reply to Michael Catanzaro from comment #1)
> Hm, this is not what I meant. I assumed it was obvious that
> maybe_make_directory() functions like "mkdir -p". So I think the current
> name is fine. 
> But we should have a function that operates like plain "mkdir"
> so that you can use it in tests in cases where the directory should
> definitely not already exist, as in bug #168036.
> 

I don't think we need such function. If I want to ensure the directory doesn't exits I can test for that with MockFileSystem.isdir()

I'll land a follow-up patch for that in bug 168036.


> This is very unimportant. :)

Ok. Let's close this then.