-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsimple_test.py
More file actions
executable file
·38 lines (27 loc) · 843 Bytes
/
simple_test.py
File metadata and controls
executable file
·38 lines (27 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#! /usr/bin/env python
import os
import unittest
import tempfile
import subprocess
class TestLessCompiler(unittest.TestCase):
def setUp(self):
tmp_file = tempfile.gettempdir()
self.less_file = os.path.join(tmp_file, 'test.less')
self.css_file = os.path.join(tmp_file, 'test.css')
def tearDown(self):
os.remove(self.less_file)
os.remove(self.css_file)
def test_can_compile_sample_file(self):
with open(self.less_file, 'w') as less_fh:
less_fh.write("""@mycolor: #000;
body {
background-color: @mycolor;
}""")
subprocess.call(['lessc', self.less_file, self.css_file])
with open(self.css_file) as css_fh:
self.assertEquals(css_fh.read(), """body {
background-color: #000000;
}
""")
if __name__ == "__main__":
unittest.main()