Bug 1471622 - Fix mozfile's test_extract.py under Python 3.5; r=davehunt

MozReview-Commit-ID: 5c8SoMMpv70

--HG--
extra : rebase_source : 65717f1f056d43588b4df59ea765a7ec2e2657c0
This commit is contained in:
Raphael Pierzina 2018-07-03 09:56:18 +02:00
Родитель 67e3369c94
Коммит 79eaf1fafd
2 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -1,7 +1,6 @@
[DEFAULT] [DEFAULT]
subsuite = mozbase, os == "linux" subsuite = mozbase, os == "linux"
[test_extract.py] [test_extract.py]
skip-if = python == 3
[test_load.py] [test_load.py]
skip-if = python == 3 skip-if = python == 3
[test_move_remove.py] [test_move_remove.py]

Просмотреть файл

@ -112,14 +112,16 @@ class TestExtract(unittest.TestCase):
os.write(fd, b'This is not a zipfile or tarball') os.write(fd, b'This is not a zipfile or tarball')
os.close(fd) os.close(fd)
exception = None exception = None
try: try:
dest = tempfile.mkdtemp() dest = tempfile.mkdtemp()
mozfile.extract(filename, dest) mozfile.extract(filename, dest)
except Exception as exception: except Exception as exc:
pass exception = exc
finally: finally:
os.remove(filename) os.remove(filename)
os.rmdir(dest) os.rmdir(dest)
self.assertTrue(isinstance(exception, Exception)) self.assertTrue(isinstance(exception, Exception))
# utility functions # utility functions