Skip to content

Commit

Permalink
use thread in test for coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
binux committed Nov 4, 2014
1 parent c7a8503 commit 7fc3df2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ install:
script:
coverage run --source=database,scheduler,fetcher,processor,result,libs ./runtest.py
after_success:
coveralls
- coverage combine
- coveralls
8 changes: 5 additions & 3 deletions test/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import logging.config
logging.config.fileConfig("logging.conf")


from scheduler.task_queue import TaskQueue
class TestTaskQueue(unittest.TestCase):
@classmethod
Expand Down Expand Up @@ -111,13 +110,16 @@ def run_scheduler():
run_in_thread(scheduler.xmlrpc_run, port=self.scheduler_xmlrpc_port)
scheduler.run()

self.process = run_in_subprocess(run_scheduler)
self.process = run_in_thread(run_scheduler)
time.sleep(1)

@classmethod
def tearDownClass(self):
if self.process.is_alive():
self.rpc._quit()
self.process.join(5)
assert not self.process.is_alive()
shutil.rmtree('./test/data/', ignore_errors=True)
self.process.terminate()

def test_10_new_task_ignore(self):
self.newtask_queue.put({
Expand Down

0 comments on commit 7fc3df2

Please sign in to comment.