Permalink
Browse files

Tests inherit from unittest and not Nose

  • Loading branch information...
1 parent ba95915 commit f733a706758849405f02c696db08dfb5e6a300bb @StephenBrown committed Dec 16, 2011
Showing with 16 additions and 12 deletions.
  1. +16 −12 tests/test_compress.py
@@ -1,10 +1,11 @@
+import unittest
from nose.tools import *
import os.path
import compression
CONFIG = os.path.join('tests', 'resources', 'test.config')
-class TestCombine:
+class TestCombine(unittest.TestCase):
def setUp(self):
self.out_file = os.path.relpath('out.temp')
@@ -19,7 +20,7 @@ def test_one_file(self):
in_files = [os.path.join('tests', 'resources', 'css', 'one-line.css')]
compression.combine(in_files, self.out_file)
text = open(self.out_file).read()
- eq_(text, 'body {background-color : red;}\n')
+ self.assertEquals(text, 'body {background-color : red;}\n')
def test_two_files(self):
in_files = [
@@ -32,7 +33,7 @@ def test_two_files(self):
'''
compression.combine(in_files, self.out_file)
text = open(self.out_file).read()
- eq_(text, expected)
+ self.assertEquals(text, expected)
class TestCompress:
@@ -50,35 +51,38 @@ def test_js(self):
compression.compress(in_file, self.out_file)
expected = 'var test;'
result = open(self.out_file).read()
- eq_(result, expected)
+ self.assertEquals(result, expected)
def test_css(self):
in_file = os.path.join('tests', 'resources', 'css', 'one-line.css')
compression.compress(in_file, self.out_file, in_type='css')
expected = 'body{background-color:red;}'
result = open(self.out_file).read()
- eq_(result, expected)
+ self.assertEquals(result, expected)
-class TestConfig:
+class TestConfig(unittest.TestCase):
def __init__(self):
self.config = compression.parse_config(CONFIG)
def test_right_number_sections(self):
result = self.config
- eq_(len(result.keys()), 2)
+ self.assertEquals(len(result.keys()), 2)
def test_keys_lowered(self):
result = self.config
- ok_('scripts' in result.keys())
- ok_('stylesheets' in result.keys())
+ self.assertTrue('scripts' in result.keys())
+ self.assertTrue('stylesheets' in result.keys())
def test_parse_config(self):
result = self.config
- eq_(len(result['scripts']), 2)
- eq_(len(result['stylesheets']), 1)
+ self.assertEquals(len(result['scripts']), 2)
+ self.assertEquals(len(result['stylesheets']), 1)
def test_paths_made(self):
result = self.config
- eq_(os.path.join('resources', 'js', 'combined-1.js'),
+ self.assertEquals(os.path.join('resources', 'js', 'combined-1.js'),
result['scripts']['file 1']['out-file-combined-path'])
+
+if __main__=="__main__":
+ unittest.main()

0 comments on commit f733a70

Please sign in to comment.