You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/app-portage/g-sorcery/files/g-sorcery-0.2.1-py3.7.tests...

141 lines
4.4 KiB

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"))