From c91a009c6de3bb63ff2cda64b5bfbd696d02cc2f Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Fri, 27 Mar 2015 01:02:28 +0100 Subject: [PATCH] tests: Move task data creation to each test --- tests/test_integration.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/tests/test_integration.py b/tests/test_integration.py index 85a7c82..656ed91 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -11,6 +11,7 @@ class IntegrationTest(object): viminput = None vimoutput = None + tasks = [] def add_plugin(self, name): plugin_base = os.path.expanduser('~/.vim/bundle/') @@ -31,16 +32,9 @@ class IntegrationTest(object): def generate_data(self): self.dir = tempfile.mkdtemp(dir='/tmp/') self.tw = TaskWarrior(data_location=self.dir) - self.tasks = [ - Task(self.tw, description="project random task 1", project="Random"), - Task(self.tw, description="project random task 2", project="Random"), - Task(self.tw, description="tag home task 1", tags=["home"]), - Task(self.tw, description="tag work task 1", tags=["work"]), - Task(self.tw, description="today task 1", due="now"), - ] - for task in self.tasks: - task.save() + for task_kwargs in self.tasks: + Task(self.tw, **task_kwargs).save() def setup(self): self.generate_data() @@ -118,6 +112,7 @@ class IntegrationTest(object): # Do the stuff self.execute() + # Helper function that fills in {uuid} placeholders with correct UUIDs def fill_uuid(line): # Tasks in testing can have only alphanumerical descriptions match = re.match(r'\s*\* \[ \] (?P[a-zA-Z0-9 ]*)(?