Bug 171268
| Summary: | Rename MockFileSystem.maybe_make_directory() | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Carlos Alberto Lopez Perez <clopez> |
| Component: | Tools / Tests | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED WONTFIX | ||
| Severity: | Normal | CC: | lforschler, mcatanzaro |
| Priority: | P2 | ||
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=168036 | ||
Carlos Alberto Lopez Perez
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"
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Michael Catanzaro
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. :)
Carlos Alberto Lopez Perez
(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.