From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 89E631381F3 for ; Tue, 2 Jul 2013 10:21:13 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DF702E09B5; Tue, 2 Jul 2013 10:21:08 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3AD33E09B5 for ; Tue, 2 Jul 2013 10:21:08 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 222C433E64B for ; Tue, 2 Jul 2013 10:21:07 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id C2A20E5460 for ; Tue, 2 Jul 2013 10:21:05 +0000 (UTC) From: "Jauhien Piatlicki" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Jauhien Piatlicki" Message-ID: <1372760535.70190446ac3e2be5fc946da165a9eb81d8d6594b.jauhien@gentoo> Subject: [gentoo-commits] proj/g-sorcery:master commit in: tests/ X-VCS-Repository: proj/g-sorcery X-VCS-Files: tests/server.py tests/test_package_db.py X-VCS-Directories: tests/ X-VCS-Committer: jauhien X-VCS-Committer-Name: Jauhien Piatlicki X-VCS-Revision: 70190446ac3e2be5fc946da165a9eb81d8d6594b X-VCS-Branch: master Date: Tue, 2 Jul 2013 10:21:05 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: dbd06ad6-3759-43c9-9773-a2699872c913 X-Archives-Hash: b2e96c04db688a745b4d28e430530939 commit: 70190446ac3e2be5fc946da165a9eb81d8d6594b Author: Jauhien Piatlicki (jauhien) gmail com> AuthorDate: Tue Jul 2 10:22:15 2013 +0000 Commit: Jauhien Piatlicki gmail com> CommitDate: Tue Jul 2 10:22:15 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/g-sorcery.git;a=commit;h=70190446 tests/server: separate http server --- tests/server.py | 26 ++++++++++++++++++++++++++ tests/test_package_db.py | 17 ++--------------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/tests/server.py b/tests/server.py new file mode 100644 index 0000000..ba4ed99 --- /dev/null +++ b/tests/server.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" + server.py + ~~~~~~~~~ + + test server + + :copyright: (c) 2013 by Jauhien Piatlicki + :license: GPL-2, see LICENSE for more details. +""" + +import http.server, threading + +class Server(threading.Thread): + def __init__(self): + super().__init__() + server_address = ('127.0.0.1', 8080) + self.httpd = http.server.HTTPServer(server_address, http.server.SimpleHTTPRequestHandler) + + def run(self): + self.httpd.serve_forever() + + def shutdown(self): + self.httpd.shutdown() diff --git a/tests/test_package_db.py b/tests/test_package_db.py index 2994157..1433eb7 100644 --- a/tests/test_package_db.py +++ b/tests/test_package_db.py @@ -11,24 +11,11 @@ :license: GPL-2, see LICENSE for more details. """ -import json, http.server, os, shutil, tempfile, threading, \ - unittest +import json, os, shutil, tempfile, unittest from g_sorcery import package_db, exceptions - -class Server(threading.Thread): - def __init__(self): - super().__init__() - server_address = ('127.0.0.1', 8080) - self.httpd = http.server.HTTPServer(server_address, http.server.SimpleHTTPRequestHandler) - - def run(self): - self.httpd.serve_forever() - - def shutdown(self): - self.httpd.shutdown() - +from tests.server import Server class DummyDB(package_db.PackageDB): def __init__(self, directory, packages):