1 |
commit: 23e01324f86644a93701bf17819a55a51dbac72f |
2 |
Author: Jauhien Piatlicki (jauhien) <piatlicki <AT> gmail <DOT> com> |
3 |
AuthorDate: Mon Jul 1 19:33:34 2013 +0000 |
4 |
Commit: Jauhien Piatlicki <piatlicki <AT> gmail <DOT> com> |
5 |
CommitDate: Mon Jul 1 19:33:34 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=23e01324 |
7 |
|
8 |
executable and the main module added |
9 |
|
10 |
--- |
11 |
bin/g-sorcery | 18 ++++++++++++++++++ |
12 |
g_sorcery/g_sorcery.py | 20 ++++++++++++++++++++ |
13 |
scripts/run_tests.py | 2 ++ |
14 |
tests/test_g_sorcery.py | 33 +++++++++++++++++++++++++++++++++ |
15 |
4 files changed, 73 insertions(+) |
16 |
|
17 |
diff --git a/bin/g-sorcery b/bin/g-sorcery |
18 |
new file mode 100755 |
19 |
index 0000000..b945070 |
20 |
--- /dev/null |
21 |
+++ b/bin/g-sorcery |
22 |
@@ -0,0 +1,18 @@ |
23 |
+#!/usr/bin/env python |
24 |
+# -*- coding: utf-8 -*- |
25 |
+ |
26 |
+""" |
27 |
+ g-sorcery |
28 |
+ ~~~~~~~~~ |
29 |
+ |
30 |
+ g-sorcery executable |
31 |
+ |
32 |
+ :copyright: (c) 2013 by Jauhien Piatlicki |
33 |
+ :license: GPL-2, see LICENSE for more details. |
34 |
+""" |
35 |
+ |
36 |
+import sys |
37 |
+from g_sorcery import g_sorcery |
38 |
+ |
39 |
+if __name__ == "__main__": |
40 |
+ sys.exit(g_sorcery.main()) |
41 |
|
42 |
diff --git a/g_sorcery/g_sorcery.py b/g_sorcery/g_sorcery.py |
43 |
new file mode 100644 |
44 |
index 0000000..dd90c96 |
45 |
--- /dev/null |
46 |
+++ b/g_sorcery/g_sorcery.py |
47 |
@@ -0,0 +1,20 @@ |
48 |
+#!/usr/bin/env python |
49 |
+# -*- coding: utf-8 -*- |
50 |
+ |
51 |
+""" |
52 |
+ g_sorcery.py |
53 |
+ ~~~~~~~~~~~~ |
54 |
+ |
55 |
+ the main module |
56 |
+ |
57 |
+ :copyright: (c) 2013 by Jauhien Piatlicki |
58 |
+ :license: GPL-2, see LICENSE for more details. |
59 |
+""" |
60 |
+ |
61 |
+import sys |
62 |
+ |
63 |
+def main(): |
64 |
+ print('it works') |
65 |
+ |
66 |
+if __name__ == "__main__": |
67 |
+ sys.exit(main()) |
68 |
|
69 |
diff --git a/scripts/run_tests.py b/scripts/run_tests.py |
70 |
index 17395ea..49432d7 100755 |
71 |
--- a/scripts/run_tests.py |
72 |
+++ b/scripts/run_tests.py |
73 |
@@ -26,6 +26,8 @@ tests_dir = os.path.join(root_dir, 'tests') |
74 |
# adding the tests directory to the top of the PYTHONPATH |
75 |
sys.path = [root_dir, tests_dir] + sys.path |
76 |
|
77 |
+os.environ["PYTHONPATH"] = ':'.join([root_dir, tests_dir]) |
78 |
+ |
79 |
suites = [] |
80 |
|
81 |
# getting the test suites from the python modules (files that ends whit .py) |
82 |
|
83 |
diff --git a/tests/test_g_sorcery.py b/tests/test_g_sorcery.py |
84 |
new file mode 100644 |
85 |
index 0000000..7241b19 |
86 |
--- /dev/null |
87 |
+++ b/tests/test_g_sorcery.py |
88 |
@@ -0,0 +1,33 @@ |
89 |
+#!/usr/bin/env python |
90 |
+# -*- coding: utf-8 -*- |
91 |
+ |
92 |
+""" |
93 |
+ test_g_sorcery.py |
94 |
+ ~~~~~~~~~~~~~~~~~ |
95 |
+ |
96 |
+ executable and main module test suite |
97 |
+ |
98 |
+ :copyright: (c) 2013 by Jauhien Piatlicki |
99 |
+ :license: GPL-2, see LICENSE for more details. |
100 |
+""" |
101 |
+ |
102 |
+import os, subprocess, tempfile, unittest |
103 |
+ |
104 |
+class TestBin(unittest.TestCase): |
105 |
+ def setUp(self): |
106 |
+ self.tempdir = tempfile.TemporaryDirectory() |
107 |
+ |
108 |
+ def tearDown(self): |
109 |
+ del self.tempdir |
110 |
+ |
111 |
+ def test_g_sorcery(self): |
112 |
+ binpath = os.path.join(os.path.split( |
113 |
+ os.path.dirname(os.path.realpath(__file__)))[0], 'bin') |
114 |
+ binary = os.path.join(binpath, 'g-sorcery') |
115 |
+ self.assertEqual(subprocess.check_output(binary), b'it works\n') |
116 |
+ |
117 |
+ |
118 |
+def suite(): |
119 |
+ suite = unittest.TestSuite() |
120 |
+ suite.addTest(TestBin('test_g_sorcery')) |
121 |
+ return suite |