aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2010-05-28 00:30:04 -0300
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2010-05-28 00:30:04 -0300
commit9c677c0a6eba665ca93ca8b04098a455b7f53f7a (patch)
treee53ae77fb323561e478559f038a677d53b24b5d5 /tests
parentsmall fix in the script that run the tests (scripts/run_tests.py) to allow th... (diff)
downloadg-octave-9c677c0a6eba665ca93ca8b04098a455b7f53f7a.tar.gz
g-octave-9c677c0a6eba665ca93ca8b04098a455b7f53f7a.tar.bz2
g-octave-9c677c0a6eba665ca93ca8b04098a455b7f53f7a.zip
changes in the config module (g_octave/config.py), added tests to the overlay module (tests/test_overlay.py, not finished and broken). added comment header to the ebuid module (g_octave/overlay.py)
Diffstat (limited to 'tests')
-rw-r--r--tests/test_overlay.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/test_overlay.py b/tests/test_overlay.py
new file mode 100644
index 0000000..c5d854f
--- /dev/null
+++ b/tests/test_overlay.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+ test_overlay.py
+ ~~~~~~~~~~~~~~~
+
+ test suite for the *g_octave.overlay* module
+
+ :copyright: (c) 2010 by Rafael Goncalves Martins
+ :license: GPL-2, see LICENSE for more details.
+"""
+
+import ConfigParser
+import os
+import shutil
+import tempfile
+import unittest
+
+from g_octave import config, overlay
+
+
+class TestOverlay(unittest.TestCase):
+
+ def setUp(self):
+ self._config_file = tempfile.mkstemp(suffix='.cfg')[1]
+ self._dir = tempfile.mkdtemp()
+
+ # the directories doesn't need to be created. the config module
+ # will do this
+ self._db = os.path.join(self._dir, 'db')
+ self._cache = os.path.join(self._dir, 'cache')
+ self._overlay = os.path.join(self._dir, 'overlay')
+
+ cp = ConfigParser.ConfigParser()
+ cp.add_section('main')
+ cp.set('main', 'db', self._db)
+ cp.set('main', 'cache', self._cache)
+ cp.set('main', 'overlay', self._overlay)
+
+ with open(self._config_file, 'w') as fp:
+ cp.write(fp)
+
+ self._config = config.Config(
+ fetch_phase = True,
+ config_file = self._config_file,
+ create_dirs = True
+ )
+
+ def test_overlay(self):
+ overlay.create_overlay(conf = self._config, quiet = True)
+
+ def tearDown(self):
+ shutil.rmtree(self._dir)
+ os.unlink(self._config_file)
+
+
+def suite():
+ suite = unittest.TestSuite()
+ suite.addTest(TestOverlay('test_overlay'))
+ return suite
+