~ubuntu-branches/ubuntu/trusty/swift/trusty-updates

« back to all changes in this revision

Viewing changes to test/unit/container/test_updater.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, James Page, Chuck Short
  • Date: 2013-08-13 10:37:13 UTC
  • mfrom: (1.2.21)
  • Revision ID: package-import@ubuntu.com-20130813103713-1ctbx4zifyljs2aq
Tags: 1.9.1-0ubuntu1
[ James Page ]
* d/control: Update VCS fields for new branch locations.

[ Chuck Short ]
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
import cPickle as pickle
17
17
import os
18
18
import unittest
 
19
from contextlib import closing
19
20
from gzip import GzipFile
20
21
from shutil import rmtree
21
22
from tempfile import mkdtemp
38
39
        self.testdir = os.path.join(mkdtemp(), 'tmp_test_container_updater')
39
40
        rmtree(self.testdir, ignore_errors=1)
40
41
        os.mkdir(self.testdir)
41
 
        pickle.dump(RingData([[0, 1, 0, 1], [1, 0, 1, 0]],
42
 
            [{'id': 0, 'ip': '127.0.0.1', 'port': 12345, 'device': 'sda1',
43
 
              'zone': 0},
44
 
             {'id': 1, 'ip': '127.0.0.1', 'port': 12345, 'device': 'sda1',
45
 
              'zone': 2}], 30),
46
 
            GzipFile(os.path.join(self.testdir, 'account.ring.gz'), 'wb'))
 
42
        ring_file = os.path.join(self.testdir, 'account.ring.gz')
 
43
        with closing(GzipFile(ring_file, 'wb')) as f:
 
44
            pickle.dump(RingData([[0, 1, 0, 1], [1, 0, 1, 0]],
 
45
                [{'id': 0, 'ip': '127.0.0.1', 'port': 12345, 'device': 'sda1',
 
46
                  'zone': 0},
 
47
                 {'id': 1, 'ip': '127.0.0.1', 'port': 12345, 'device': 'sda1',
 
48
                  'zone': 2}], 30),
 
49
                f)
47
50
        self.devices_dir = os.path.join(self.testdir, 'devices')
48
51
        os.mkdir(self.devices_dir)
49
52
        self.sda1 = os.path.join(self.devices_dir, 'sda1')