JSON fix; test file templating.

This commit is contained in:
Audrey Roy 2013-07-14 19:56:26 +02:00
parent 752f59fbf3
commit c62f6e0589
3 changed files with 32 additions and 49 deletions

View File

@ -8,5 +8,5 @@
"travis_ci_username": "audreyr",
"release_date": "2013-07-10",
"year": "2013",
"version": "0.1.1",
}
"version": "0.1.1"
}

View File

@ -1,47 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_complexity
------------
Tests for `complexity` module.
"""
import os
import shutil
import unittest
from complexity import complexity
class TestComplexity(unittest.TestCase):
def setUp(self):
# os.chdir('tests/')
os.mkdir('output/')
def test_make_sure_path_exists(self):
self.assertTrue(complexity.make_sure_path_exists('/usr/'))
self.assertFalse(
complexity.make_sure_path_exists(
'/this-dir-does-not-exist-and-cant-be-created/'
)
)
def test_generate_html(self):
complexity.generate_html(['index', 'about'], context=None, input_dir='tests/input')
self.assertTrue(os.path.isfile('output/index.html'))
self.assertTrue(os.path.isfile('output/about/index.html'))
def test_generate_context(self):
context = complexity.generate_context(input_dir='tests/input')
self.assertEqual(context, {"test": {"1": 2}})
def tearDown(self):
shutil.rmtree('output/')
if __name__ == '__main__':
unittest.main()

30
package/tests/test_package.py Executable file
View File

@ -0,0 +1,30 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_{{ project.repo_name }}
------------
Tests for `{{ project.repo_name }}` module.
"""
import os
import shutil
import unittest
from {{ project.repo_name }} import {{ project.repo_name }}
class TestComplexity(unittest.TestCase):
def setUp(self):
pass
def test_something(self):
pass
def tearDown(self):
pass
if __name__ == '__main__':
unittest.main()