Commit 3d0be9fd authored by Erik M. Bray's avatar Erik M. Bray

Fix random failures of the test common_include_dir on Windows

os.rename() could fail sometimes with a permission error; using shutil.move() instead seems to be more robust against that.
parent 7351387d
...@@ -13,6 +13,7 @@ cython.declare(os=object, re=object, operator=object, ...@@ -13,6 +13,7 @@ cython.declare(os=object, re=object, operator=object,
import os import os
import re import re
import shutil
import sys import sys
import operator import operator
import textwrap import textwrap
...@@ -1722,7 +1723,7 @@ class CCodeWriter(object): ...@@ -1722,7 +1723,7 @@ class CCodeWriter(object):
tmp_path = '%s.tmp%s' % (path, os.getpid()) tmp_path = '%s.tmp%s' % (path, os.getpid())
with closing(Utils.open_new_file(tmp_path)) as f: with closing(Utils.open_new_file(tmp_path)) as f:
f.write(code) f.write(code)
os.rename(tmp_path, path) shutil.move(tmp_path, path)
code = '#include "%s"\n' % path code = '#include "%s"\n' % path
self.put(code) self.put(code)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment