Replace file() with open() for Python 3 compatibility

The built-in named 'file' has been removed since Python 3.0 [1]
This patch replaces it by 'open' which is the same under Python 2 and 3.

[1] https://docs.python.org/release/3.0/whatsnew/3.0.html#builtins

Change-Id: I0d8b6ef1501f7eabc47fb767b0581ac49b646962
This commit is contained in:
Vu Cong Tuan 2018-07-05 10:33:03 +07:00
parent 9608a30508
commit 65bc4a730e
1 changed files with 1 additions and 1 deletions

View File

@ -48,7 +48,7 @@ class TestPkgInfo(unittest.TestCase):
sc = os.path.join(td, 'saved_config.txt')
pi.save_config(sc)
exp = 'NAME=c\nVERSION=a\nRELEASE=b\n'
contents = file(sc, 'r').read()
contents = open(sc, 'r').read()
assert contents == exp
finally:
shutil.rmtree(td)