Skip to content

Commit

Permalink
Merge pull request swiftlang#8365 from hughbe/gyb-tests-windows
Browse files Browse the repository at this point in the history
Fix GYB tests on Windows
  • Loading branch information
hughbe authored Mar 28, 2017
2 parents 5663f67 + 0b2e5bf commit 67faf0e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion utils/gyb.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,11 @@ def expand(filename, line_directive=_default_line_directive, **local_bindings):
local bindings.
>>> from tempfile import NamedTemporaryFile
>>> f = NamedTemporaryFile()
>>> # On Windows, the name of a NamedTemporaryFile cannot be used to open
>>> # the file for a second time if delete=True. Therefore, we have to
>>> # manually handle closing and deleting this file to allow us to open
>>> # the file by its name across all platforms.
>>> f = NamedTemporaryFile(delete=False)
>>> f.write(
... r'''---
... % for i in range(int(x)):
Expand Down Expand Up @@ -786,6 +790,8 @@ def expand(filename, line_directive=_default_line_directive, **local_bindings):
y
//#sourceLocation(file: "dummy.file", line: 10)
z
>>> f.close()
>>> os.remove(f.name)
"""
with open(filename) as f:
t = parse_template(filename, f.read())
Expand Down

0 comments on commit 67faf0e

Please sign in to comment.