Skip to content

Commit

Permalink
Add tests for detaching pyzord.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkiro committed Sep 25, 2014
1 parent c5c2bf0 commit 0998c01
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/functional/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,29 @@ def tearDownClass(cls):
redis.StrictRedis(db=10).flushdb()


class DetachPyzorTest(PyzorTestBase):
detach = "/dev/null"
homedir = os.path.join(os.getcwd(), "pyzor-test")

def test_pid(self):
self.assertTrue(os.path.exists(os.path.join(self.homedir,
"pyzord.pid")))

@classmethod
def tearDownClass(cls):
with open(os.path.join(cls.homedir, "pyzord.pid")) as pidf:
pid = int(pidf.read().strip())
os.kill(pid, 15)
super(DetachPyzorTest, cls).tearDownClass()


def suite():
"""Gather all the tests from this module in a test suite."""
test_suite = unittest.TestSuite()
test_suite.addTest(unittest.makeSuite(MySQLdbBatchedPyzorTest))
# test_suite.addTest(unittest.makeSuite(GdbmBatchedPyzorTest))
test_suite.addTest(unittest.makeSuite(RedisBatchedPyzorTest))
test_suite.addTest(unittest.makeSuite(DetachPyzorTest))
return test_suite

if __name__ == '__main__':
Expand Down
1 change: 1 addition & 0 deletions tests/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class PyzorTestBase(unittest.TestCase):
"access_file": "--access-file",
"cleanup_age": "--cleanup-age",
"log_file": "--log-file",
"detach": "--detach",
}
homedir = "./pyzor-test/"
threads = "False"
Expand Down

0 comments on commit 0998c01

Please sign in to comment.