Commit 5a55d45e authored by Kai Lautaportti's avatar Kai Lautaportti

Explicitly set file access bits in tests.

parent f32735bc
...@@ -5,6 +5,7 @@ import errno ...@@ -5,6 +5,7 @@ import errno
import os import os
import re import re
import shutil import shutil
import stat
import tarfile import tarfile
import tempfile import tempfile
import unittest import unittest
...@@ -29,11 +30,12 @@ class NonInformativeTests(unittest.TestCase): ...@@ -29,11 +30,12 @@ class NonInformativeTests(unittest.TestCase):
def tearDown(self): def tearDown(self):
shutil.rmtree(self.dir) shutil.rmtree(self.dir)
def write_file(self, filename, contents): def write_file(self, filename, contents, mode=stat.S_IREAD|stat.S_IWUSR):
path = os.path.join(self.dir, filename) path = os.path.join(self.dir, filename)
fh = open(path, 'w') fh = open(path, 'w')
fh.write(contents) fh.write(contents)
fh.close() fh.close()
os.chmod(path, mode)
return path return path
def make_recipe(self, buildout, name, options): def make_recipe(self, buildout, name, options):
...@@ -108,9 +110,9 @@ class NonInformativeTests(unittest.TestCase): ...@@ -108,9 +110,9 @@ class NonInformativeTests(unittest.TestCase):
temp_directory = tempfile.mkdtemp(dir=self.dir, prefix="fake_package") temp_directory = tempfile.mkdtemp(dir=self.dir, prefix="fake_package")
configure_path = os.path.join(temp_directory, 'configure') configure_path = os.path.join(temp_directory, 'configure')
self.write_file(configure_path, 'exit 0') self.write_file(configure_path, 'exit 0', mode=stat.S_IRWXU)
makefile_path = os.path.join(temp_directory, 'Makefile') makefile_path = os.path.join(temp_directory, 'Makefile')
self.write_file(makefile_path, 'exit -1') self.write_file(makefile_path, 'all:\n\texit -1')
os.chdir(temp_directory) os.chdir(temp_directory)
......
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