Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(228)

Side by Side Diff: charmworld/testing/factory.py

Issue 88980043: Fix spurious error.
Patch Set: Created 10 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « charmworld/lp.py ('k') | charmworld/tests/test_lp.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2012, 2013 Canonical Ltd. This software is licensed under the 1 # Copyright 2012, 2013 Canonical Ltd. This software is licensed under the
2 # GNU Affero General Public License version 3 (see the file LICENSE). 2 # GNU Affero General Public License version 3 (see the file LICENSE).
3 3
4 """Helpers to generate test data for use.""" 4 """Helpers to generate test data for use."""
5 5
6 from bzrlib.bzrdir import BzrDir 6 from bzrlib.bzrdir import BzrDir
7 from contextlib import contextmanager 7 from contextlib import contextmanager
8 from calendar import timegm 8 from calendar import timegm
9 from datetime import ( 9 from datetime import (
10 date, 10 date,
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 def get_bundle_data(name=None, owner=None, basket_with_rev=None, 353 def get_bundle_data(name=None, owner=None, basket_with_rev=None,
354 series='precise', title='', description='', 354 series='precise', title='', description='',
355 services=dict(), relations=dict(), promulgated=False, 355 services=dict(), relations=dict(), promulgated=False,
356 branch_deleted=False, 356 branch_deleted=False,
357 ): 357 ):
358 if name is None: 358 if name is None:
359 name = random_string(10) 359 name = random_string(10)
360 if owner is None: 360 if owner is None:
361 owner = random_string(10) 361 owner = random_string(10)
362 if basket_with_rev is None: 362 if basket_with_rev is None:
363 basket_with_rev = "%s/%d" % (random_string(10), randint(0, 100)) 363 basket_with_rev = "%s/%d" % (random_string(10), randint(1, 100))
364 data = dict(series=series, 364 data = dict(series=series,
365 relations=relations, 365 relations=relations,
366 services=services) 366 services=services)
367 bundle_doc = make_bundle_doc( 367 bundle_doc = make_bundle_doc(
368 data, owner, basket_with_rev, name, None, None, None, None) 368 data, owner, basket_with_rev, name, None, None, None, None)
369 bundle_doc.update(dict(branch_deleted=branch_deleted, 369 bundle_doc.update(dict(branch_deleted=branch_deleted,
370 data=data, 370 data=data,
371 description=description, 371 description=description,
372 promulgated=promulgated, 372 promulgated=promulgated,
373 title=title)) 373 title=title))
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 822
823 @contextmanager 823 @contextmanager
824 def bundle_branch(bundle_path=None, extra=[]): 824 def bundle_branch(bundle_path=None, extra=[]):
825 """Create a Bazaar branch from the files in bundle_path.""" 825 """Create a Bazaar branch from the files in bundle_path."""
826 # Avoid circular imports. 826 # Avoid circular imports.
827 if bundle_path is None: 827 if bundle_path is None:
828 bundle_path = os.path.split(__file__)[0] 828 bundle_path = os.path.split(__file__)[0]
829 bundle_path = os.path.join(bundle_path, 'data/sample_bundle') 829 bundle_path = os.path.join(bundle_path, 'data/sample_bundle')
830 with _sample_branch(bundle_path, extra) as (branch_dir, rev): 830 with _sample_branch(bundle_path, extra) as (branch_dir, rev):
831 yield branch_dir, rev, bundle_path 831 yield branch_dir, rev, bundle_path
OLDNEW
« no previous file with comments | « charmworld/lp.py ('k') | charmworld/tests/test_lp.py » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b