|
2 | 2 | import pyv8unpack
|
3 | 3 | from os import path as path
|
4 | 4 | import tempfile
|
| 5 | +import shutil |
5 | 6 |
|
6 | 7 |
|
7 | 8 | class TestV8Unpack(unittest.TestCase):
|
| 9 | + |
| 10 | + def setUp(self): |
| 11 | + unittest.TestCase.setUp(self) |
| 12 | + self.tpath = tempfile.mkdtemp() |
| 13 | + self.tfile = tempfile.mktemp() |
| 14 | + |
| 15 | + def tearDown(self): |
| 16 | + import os |
| 17 | + if os.path.exists(self.tfile): |
| 18 | + os.remove(self.tfile) |
| 19 | + shutil.rmtree(self.tpath) |
8 | 20 |
|
9 |
| - def test_compile_from_source(self): |
10 | 21 |
|
11 |
| - tpath = tempfile.mkdtemp() |
| 22 | + def test_compile_from_source(self): |
| 23 | + |
| 24 | + self.tpath = tempfile.mkdtemp() |
12 | 25 | file = path.join(path.curdir, "tests", "Fixture.epf")
|
13 |
| - assert pyv8unpack.decompile([file], tpath) |
14 |
| - tpath = path.join(tpath, "tests", "Fixture") |
15 |
| - filenew = tempfile.mktemp() |
16 |
| - assert pyv8unpack.compilefromsource(tpath, filenew, "epf") == filenew |
| 26 | + assert pyv8unpack.decompile([file], self.tpath) |
| 27 | + tpath = path.join(self.tpath, "tests", "Fixture") |
| 28 | + assert pyv8unpack.compilefromsource(tpath, self.tfile, "epf") == self.tfile |
| 29 | + self.assertTrue(path.exists(self.tfile), "Собранный файл не существует {}".format(self.tfile)) |
| 30 | + |
17 | 31 |
|
18 | 32 | def test_decompile(self):
|
19 |
| - |
20 |
| - tpath = tempfile.mkdtemp() |
| 33 | + |
| 34 | + self.tpath = tempfile.mkdtemp() |
21 | 35 | file = path.join(path.curdir, "tests", "Fixture.epf")
|
22 |
| - assert pyv8unpack.decompile([file], tpath) |
| 36 | + assert pyv8unpack.decompile([file], self.tpath) |
0 commit comments