~abentley/workspace-runner/enhanced-artifacts

« back to all changes in this revision

Viewing changes to workspace_runner/tests/__init__.py

  • Committer: Aaron Bentley
  • Date: 2015-06-19 20:57:43 UTC
  • Revision ID: aaron.bentley@canonical.com-20150619205743-f5q3499wlpzioi25
Ensure workdir is created.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
from argparse import Namespace
2
2
from contextlib import contextmanager
 
3
import os
3
4
from mock import patch
4
5
from StringIO import StringIO
5
6
from tempfile import (
43
44
 
44
45
class TestPrimitives:
45
46
 
46
 
    @contextmanager
47
 
    def primitives_context(self):
48
 
        with workspace_context('asdf', self.primitives_class) as primitives:
49
 
            yield primitives
50
 
 
51
47
    def test_run(self):
52
48
        out_file = StringIO()
53
49
        with self.primitives_context() as primitives:
94
90
 
95
91
    primitives_class = FakePrimitives
96
92
 
 
93
    @contextmanager
 
94
    def primitives_context(self):
 
95
        with workspace_context('asdf', self.primitives_class) as primitives:
 
96
            self.assertTrue(os.path.isdir(primitives.tempdir))
 
97
            yield primitives
 
98
 
97
99
    def expect_run(self, runner, args, out_file):
98
100
        runner.run(args, out_file)
99
101
        self.assertEqual(runner.run_calls, [['foo', 'bar']])