d355fa38a7cc4340ed934091d27d4e44a4a52123
10 'prepare': self
._prepare
,
16 print('Error: {}'.format(str), file=sys
.stderr
)
19 def _parse_args(self
):
20 ap
= argparse
.ArgumentParser()
22 ap
.add_argument('-s', '--size', action
='store', metavar
='SIZE',
23 type=int, required
=True, help='size')
24 ap
.add_argument('action', metavar
='ACTION', action
='store',
28 args
= ap
.parse_args()
32 MetadataTest
._perror
('wrong size: {}'.format(args
.size
))
37 return self
.what
.format(size
=self
.size
)
40 # make sure everything is clean first
43 print('Preparing test for {}'.format(self
._get
_what
()))
46 os
.mkdir(self
._trace
_dir
_path
)
48 # open and write metadata file
49 with
open(self
._metadata
_path
, 'w') as f
:
50 self
.write_metadata(f
)
53 print('Cleaning up test for {}'.format(self
._get
_what
()))
56 shutil
.rmtree(self
._trace
_dir
_path
, ignore_errors
=True)
57 except Exception as e
:
62 if self
._action
not in self
._actions
:
63 MetadataTest
._perror
('invalid action: "{}"'.format(self
._action
))
65 self
._actions
[self
._action
]()
72 args
= self
._parse
_args
()
73 self
._size
= args
.size
74 self
._trace
_dir
_path
= 'trace-{}'.format(args
.size
)
75 self
._metadata
_path
= os
.path
.join(self
._trace
_dir
_path
, 'metadata')
76 self
._action
= args
.action
This page took 0.032164 seconds and 3 git commands to generate.