public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/g-sorcery:master commit in: scripts/, g_sorcery/, bin/, tests/
@ 2013-07-01 20:51 Jauhien Piatlicki
  0 siblings, 0 replies; only message in thread
From: Jauhien Piatlicki @ 2013-07-01 20:51 UTC (permalink / raw
  To: gentoo-commits

commit:     23e01324f86644a93701bf17819a55a51dbac72f
Author:     Jauhien Piatlicki (jauhien) <piatlicki <AT> gmail <DOT> com>
AuthorDate: Mon Jul  1 19:33:34 2013 +0000
Commit:     Jauhien Piatlicki <piatlicki <AT> gmail <DOT> com>
CommitDate: Mon Jul  1 19:33:34 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=23e01324

executable and the main module added

---
 bin/g-sorcery           | 18 ++++++++++++++++++
 g_sorcery/g_sorcery.py  | 20 ++++++++++++++++++++
 scripts/run_tests.py    |  2 ++
 tests/test_g_sorcery.py | 33 +++++++++++++++++++++++++++++++++
 4 files changed, 73 insertions(+)

diff --git a/bin/g-sorcery b/bin/g-sorcery
new file mode 100755
index 0000000..b945070
--- /dev/null
+++ b/bin/g-sorcery
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+    g-sorcery
+    ~~~~~~~~~
+    
+    g-sorcery executable
+    
+    :copyright: (c) 2013 by Jauhien Piatlicki
+    :license: GPL-2, see LICENSE for more details.
+"""
+
+import sys
+from g_sorcery import g_sorcery
+
+if __name__ == "__main__":
+    sys.exit(g_sorcery.main())

diff --git a/g_sorcery/g_sorcery.py b/g_sorcery/g_sorcery.py
new file mode 100644
index 0000000..dd90c96
--- /dev/null
+++ b/g_sorcery/g_sorcery.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+    g_sorcery.py
+    ~~~~~~~~~~~~
+    
+    the main module
+    
+    :copyright: (c) 2013 by Jauhien Piatlicki
+    :license: GPL-2, see LICENSE for more details.
+"""
+
+import sys
+
+def main():
+    print('it works')
+
+if __name__ == "__main__":
+    sys.exit(main())

diff --git a/scripts/run_tests.py b/scripts/run_tests.py
index 17395ea..49432d7 100755
--- a/scripts/run_tests.py
+++ b/scripts/run_tests.py
@@ -26,6 +26,8 @@ tests_dir = os.path.join(root_dir, 'tests')
 # adding the tests directory to the top of the PYTHONPATH
 sys.path = [root_dir, tests_dir] + sys.path
 
+os.environ["PYTHONPATH"] = ':'.join([root_dir, tests_dir])
+
 suites = []
 
 # getting the test suites from the python modules (files that ends whit .py)

diff --git a/tests/test_g_sorcery.py b/tests/test_g_sorcery.py
new file mode 100644
index 0000000..7241b19
--- /dev/null
+++ b/tests/test_g_sorcery.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+    test_g_sorcery.py
+    ~~~~~~~~~~~~~~~~~
+    
+    executable and main module test suite
+    
+    :copyright: (c) 2013 by Jauhien Piatlicki
+    :license: GPL-2, see LICENSE for more details.
+"""
+
+import os, subprocess, tempfile, unittest
+
+class TestBin(unittest.TestCase):
+    def setUp(self):
+        self.tempdir = tempfile.TemporaryDirectory()
+
+    def tearDown(self):
+        del self.tempdir
+
+    def test_g_sorcery(self):
+        binpath = os.path.join(os.path.split(
+            os.path.dirname(os.path.realpath(__file__)))[0], 'bin')
+        binary = os.path.join(binpath, 'g-sorcery')
+        self.assertEqual(subprocess.check_output(binary),  b'it works\n')
+
+
+def suite():
+    suite = unittest.TestSuite()
+    suite.addTest(TestBin('test_g_sorcery'))
+    return suite


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-07-01 20:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-01 20:51 [gentoo-commits] proj/g-sorcery:master commit in: scripts/, g_sorcery/, bin/, tests/ Jauhien Piatlicki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox