python-modernize -f lib2to3.fixes.file . -w
This commit is contained in:
parent
d6a5cdf987
commit
379ec8ae63
10 changed files with 34 additions and 34 deletions
|
|
@ -83,15 +83,15 @@ class TestCompleteImageBuild(unittest.TestCase):
|
|||
def set_up_files(self, name):
|
||||
datadir = os.path.join(os.path.dirname(__file__), 'data/image', name)
|
||||
# load image result data for our test build
|
||||
data = json.load(file(datadir + '/data.json'))
|
||||
self.db_expect = json.load(file(datadir + '/db.json'))
|
||||
data = json.load(open(datadir + '/data.json'))
|
||||
self.db_expect = json.load(open(datadir + '/db.json'))
|
||||
for arch in data:
|
||||
taskdir = koji.pathinfo.task(data[arch]['task_id'])
|
||||
os.makedirs(taskdir)
|
||||
filenames = data[arch]['files'] + data[arch]['logs']
|
||||
for filename in filenames:
|
||||
path = os.path.join(taskdir, filename)
|
||||
with file(path, 'w') as fp:
|
||||
with open(path, 'w') as fp:
|
||||
fp.write('Test file for %s\n%s\n' % (arch, filename))
|
||||
self.image_data = data
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class TestCompleteMavenBuild(unittest.TestCase):
|
|||
def set_up_files(self, name):
|
||||
datadir = os.path.join(os.path.dirname(__file__), 'data/maven', name)
|
||||
# load maven result data for our test build
|
||||
data = json.load(file(datadir + '/data.json'))
|
||||
data = json.load(open(datadir + '/data.json'))
|
||||
data['task_id'] = 9999
|
||||
taskdir = koji.pathinfo.task(data['task_id'])
|
||||
for subdir in data['files']:
|
||||
|
|
@ -64,7 +64,7 @@ class TestCompleteMavenBuild(unittest.TestCase):
|
|||
dst = os.path.join(taskdir, fn)
|
||||
shutil.copy(src, dst)
|
||||
self.maven_data = data
|
||||
files = file(datadir + '/files').readlines()
|
||||
files = open(datadir + '/files').readlines()
|
||||
files = [l.strip() for l in files]
|
||||
self.expected_files = files
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class TestGetBuildLogs(unittest.TestCase):
|
|||
dirpath = os.path.dirname(path)
|
||||
koji.ensuredir(dirpath)
|
||||
if path:
|
||||
with file(path, 'w') as fo:
|
||||
with open(path, 'w') as fo:
|
||||
fo.write('TEST LOG FILE CONTENTS\n')
|
||||
|
||||
def test_get_build_logs_basic(self):
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class TestGetUploadPath(unittest.TestCase):
|
|||
fullpath = '{0}/{1}'.format(work.return_value, reldir)
|
||||
os.makedirs(fullpath)
|
||||
|
||||
with file('{0}/.user'.format(fullpath), 'wb') as f:
|
||||
with open('{0}/.user'.format(fullpath), 'wb') as f:
|
||||
f.write('1')
|
||||
|
||||
with self.assertRaises(GenericError):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue