Skip to content

Commit

Permalink
Try to fix Windows failures
Browse files Browse the repository at this point in the history
  • Loading branch information
mgedmin committed Dec 28, 2016
1 parent da34c8e commit a984e60
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions setup.py
Expand Up @@ -43,10 +43,10 @@

CUSTOM_TEST_TEMPLATE = """\
import sys
sys.path = %s
sys.path = %r
import os
os.chdir('%s')
os.chdir(%r)
# The following unused imports are dark magic that makes the tests pass on
# Python 3.5 on Travis CI. I do not understand why.
Expand All @@ -56,10 +56,11 @@
import zope.testrunner
if __name__ == '__main__':
zope.testrunner.run([
'--test-path', '%s', '-c'
'--test-path', %r, '-c'
])
"""


class custom_test(test):
# The zope.testrunner tests MUST be run using its own testrunner. This is
# because its subprocess testing will call the script it was run with. We
Expand Down Expand Up @@ -91,7 +92,13 @@ def run_tests(self):
import subprocess
process = subprocess.Popen([sys.executable, filename])
rc = process.wait()
os.unlink(filename)
try:
os.unlink(filename)
except OSError as e:
# This happens on Windows and I don't understand _why_.
sys.stderr.write("Failed to clean up temporary script %s:\n%s: %s"
% (filename, e.__class__.__name__, e))
sys.stderr.flush()
sys.exit(rc)

chapters = '\n'.join([
Expand Down

0 comments on commit a984e60

Please sign in to comment.