summaryrefslogtreecommitdiff
blob: 84a702413ac8105aa4fb4a4fd2de910b43a1d269 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
diff --git a/README.md b/README.md
index 9bdd5b7..c2eb5ad 100644
--- a/README.md
+++ b/README.md
@@ -26,3 +26,5 @@ This project is aimed to create a framework for ebuild-generators for
 3rd party software providers.
 
 If you want to develop a new backend see [developer's instructions](https://github.com/jauhien/g-sorcery/blob/master/docs/developer_instructions.rst).
+
+[TODO list](https://trello.com/b/8WdY2ZIs/framework-for-automated-ebuild-generators).
diff --git a/scripts/all_pythons.sh b/scripts/all_pythons.sh
index af4c1f1..3c85974 100755
--- a/scripts/all_pythons.sh
+++ b/scripts/all_pythons.sh
@@ -2,7 +2,7 @@
 
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 
-for VER in 2.7 3.3 3.4
+for VER in 2.7 3.6 3.7 3.8
 do
     echo
     echo "testing python${VER}"
diff --git a/tests/server.py b/tests/server.py
index 51d49b7..aa895ea 100644
--- a/tests/server.py
+++ b/tests/server.py
@@ -4,20 +4,21 @@
 """
     server.py
     ~~~~~~~~~
-    
+
     test server
-    
+
     :copyright: (c) 2013 by Jauhien Piatlicki
     :license: GPL-2, see LICENSE for more details.
 """
 
 import os
 import threading
+import time
 
 from g_sorcery.compatibility import py2k
 
 if py2k:
-    from SocketServer import TCPServer as HTTPServer 
+    from SocketServer import TCPServer as HTTPServer
     from SimpleHTTPServer import SimpleHTTPRequestHandler
 else:
     from http.server import HTTPServer
@@ -26,26 +27,27 @@ else:
 def HTTPRequestHandlerGenerator(direct):
 
     class HTTPRequestHandler(SimpleHTTPRequestHandler, object):
-        directory = direct
 
         def __init__(self, request, client_address, server):
+            self.direct = direct
             super(HTTPRequestHandler, self).__init__(request, client_address, server)
 
         def translate_path(self, path):
-            return os.path.join(self.directory, path[1:])
+            return os.path.join(self.direct, path[1:])
 
     return HTTPRequestHandler
 
-    
+
 class Server(threading.Thread):
     def __init__(self, directory, port=8080):
         super(Server, self).__init__()
         HTTPServer.allow_reuse_address = True
         server_address = ('127.0.0.1', port)
         self.httpd = HTTPServer(server_address, HTTPRequestHandlerGenerator(directory))
-    
+
     def run(self):
         self.httpd.serve_forever()
 
     def shutdown(self):
         self.httpd.shutdown()
+        time.sleep(0.5)
diff --git a/tests/test_DBGenerator.py b/tests/test_DBGenerator.py
index 9a47c86..3c28278 100644
--- a/tests/test_DBGenerator.py
+++ b/tests/test_DBGenerator.py
@@ -4,9 +4,9 @@
 """
     test_DBGenerator.py
     ~~~~~~~~~~~~~~~~~~~
-    
+
     DBGenerator test suite
-    
+
     :copyright: (c) 2013 by Jauhien Piatlicki
     :license: GPL-2, see LICENSE for more details.
 """
@@ -81,11 +81,13 @@ class TestDBGenerator(BaseTest):
         srv = Server(orig_tempdir.name)
         srv.start()
 
-        pkg_db = db_generator(self.tempdir.name, "test_repo",
+        try:
+            pkg_db = db_generator(self.tempdir.name, "test_repo",
                               common_config = common_config, config = config)
 
-        srv.shutdown()
-        srv.join()
+        finally:
+            srv.shutdown()
+            srv.join()
 
         self.assertEqual(set(pkg_db.list_categories()), set(["app-test1", "app-test2"]))
         self.assertTrue(pkg_db.in_category("app-test1", "test"))
diff --git a/tests/test_PackageDB.py b/tests/test_PackageDB.py
index 152c605..8be8f8a 100644
--- a/tests/test_PackageDB.py
+++ b/tests/test_PackageDB.py
@@ -70,11 +70,13 @@ class TestPackageDB(BaseTest):
 
             srv = Server(orig_tempdir.name, port=port)
             srv.start()
-            self.assertRaises(IntegrityError, test_db.sync, sync_address)
-            os.system("cd " + orig_tempdir.name + " && mv good.tar.gz dummy.tar.gz")
-            test_db.sync(sync_address)
-            srv.shutdown()
-            srv.join()
+            try:
+                self.assertRaises(IntegrityError, test_db.sync, sync_address)
+                os.system("cd " + orig_tempdir.name + " && mv good.tar.gz dummy.tar.gz")
+                test_db.sync(sync_address)
+            finally:
+                srv.shutdown()
+                srv.join()
             test_db.read()
             self.assertEqual(orig_db.database, test_db.database)
             self.assertEqual(orig_db.get_common_data("app-test1"), test_db.get_common_data("app-test1"))