Commit 4c58cc6f authored by Denis Bilenko's avatar Denis Bilenko

test__examples.py: protect against spaces in paths

parent 037f4e4e
...@@ -26,11 +26,19 @@ for example in examples: ...@@ -26,11 +26,19 @@ for example in examples:
print '\n'.join(examples) print '\n'.join(examples)
def make_test(path): def make_test(path):
if ' ' in path:
path = '"%s"' % path
class TestExample(unittest.TestCase): class TestExample(unittest.TestCase):
def test(self): def test(self):
res = os.system('%s %s' % (sys.executable, path)) exe = sys.executable
if ' ' in exe:
exe = '"%s"' % exe
cmd = '%s %s' % (exe, path)
print >> sys.stderr, cmd
res = os.system(cmd)
assert not res, '%s failed with %s' % (path, res) assert not res, '%s failed with %s' % (path, res)
TestExample.__name__ = 'TestExample_' + basename(path).split('.')[0] TestExample.__name__ = 'TestExample_' + basename(path).split('.')[0]
......
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