~bac/charmworld/tag-constraints

« back to all changes in this revision

Viewing changes to charmworld/jobs/tests/test_bzr.py

  • Committer: Tarmac
  • Author(s): Brad Crittenden
  • Date: 2014-05-15 20:36:22 UTC
  • mfrom: (508.1.9 ingest-local-charms)
  • Revision ID: tarmac-20140515203622-3h7hg54s44blnhlc
Allow local charm ingestion.

To bin/ingest-queued the new option --local-repo has been added.  Give the
path to a parent directory and all subdirectories that are Bazaar branches
will be ingested as charms.

Fixes bug 1319140 where the --debug option wasn't declared in the correct
place, causing bin/enqueue to die.  While the work of that script is now a
part of bin/ingest-queued it still has utility as a free-standing script and
is kept.

https://codereview.appspot.com/98280043/

R=jcsackett. Fixes: https://bugs.launchpad.net/bugs/1319140.

Approved by Juju Gui Bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
3
 
4
4
 
5
 
from contextlib import contextmanager
6
5
import datetime
7
6
from logging import getLogger
8
7
import os
25
24
)
26
25
from charmworld.models import getfs
27
26
from charmworld.testing import (
 
27
    bzr_isolation,
28
28
    factory,
29
29
    JobTestBase,
 
30
    temp_dir,
30
31
    TestCase,
31
 
    temp_dir,
32
32
)
33
33
from charmworld.utils import write_locked
34
34
 
173
173
        self.assertTrue(check_output_called)
174
174
 
175
175
 
176
 
@contextmanager
177
 
def bzr_isolation():
178
 
    with temp_dir() as temp_home:
179
 
        old_cwd = os.getcwd()
180
 
        os.chdir(temp_home)
181
 
        try:
182
 
            with patch.dict(os.environ,
183
 
                            values={
184
 
                                'HOME': temp_home,
185
 
                                'BZR_EMAIL': 'foo.bar@example.org'},
186
 
                            clear=True):
187
 
                yield temp_home
188
 
        finally:
189
 
            os.chdir(old_cwd)
190
 
 
191
 
 
192
176
class TestChangelogBzrHandling(TestCase):
193
177
 
194
178
    def setUp(self):