Skip to content
This repository was archived by the owner on Oct 25, 2018. It is now read-only.

Commit a43c813

Browse files
author
Сосна Евгений
committed
Добавленны тесты.
1 parent 354f755 commit a43c813

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

tests/test_compile.py

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,35 @@
22
import pyv8unpack
33
from os import path as path
44
import tempfile
5+
import shutil
56

67

78
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)
820

9-
def test_compile_from_source(self):
1021

11-
tpath = tempfile.mkdtemp()
22+
def test_compile_from_source(self):
23+
24+
self.tpath = tempfile.mkdtemp()
1225
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+
1731

1832
def test_decompile(self):
19-
20-
tpath = tempfile.mkdtemp()
33+
34+
self.tpath = tempfile.mkdtemp()
2135
file = path.join(path.curdir, "tests", "Fixture.epf")
22-
assert pyv8unpack.decompile([file], tpath)
36+
assert pyv8unpack.decompile([file], self.tpath)

0 commit comments

Comments
 (0)