diff --git a/openstack_releases/tests/fixtures.py b/openstack_releases/tests/fixtures.py index 2d142c9569..b275753d70 100644 --- a/openstack_releases/tests/fixtures.py +++ b/openstack_releases/tests/fixtures.py @@ -21,6 +21,8 @@ import fixtures from openstack_releases import processutils +LOG = logging.getLogger(__name__) + class GPGKeyFixture(fixtures.Fixture): """Creates a GPG key for testing. @@ -52,6 +54,7 @@ class GPGKeyFixture(fixtures.Fixture): gnupg_version = (0, 0, 0) config_file = tempdir.path + '/key-config' + LOG.debug('creating gpg config file in %s', config_file) with open(config_file, 'wt') as f: if gnupg_version[0] == 2 and gnupg_version[1] >= 1: f.write(textwrap.dedent(""" @@ -83,13 +86,12 @@ class GPGKeyFixture(fixtures.Fixture): cmd.append(gnupg_random) cmd.append('key-config') + LOG.debug('generating gpg key') processutils.check_call(cmd, cwd=tempdir.path) class GitRepoFixture(fixtures.Fixture): - logger = logging.getLogger('git') - def __init__(self, workdir, name): self.workdir = workdir self.name = name @@ -100,6 +102,7 @@ class GitRepoFixture(fixtures.Fixture): super().setUp() self.useFixture(GPGKeyFixture()) os.makedirs(self.path) + LOG.debug('initializing repo in %s', self.path) self.git('init', '.') self.git('config', '--local', 'user.email', 'example@example.com') self.git('config', '--local', 'user.name', 'super developer') @@ -107,24 +110,26 @@ class GitRepoFixture(fixtures.Fixture): 'example@example.com') def git(self, *args): - self.logger.debug('$ git %s', ' '.join(args)) output = processutils.check_output( ['git'] + list(args), cwd=self.path, ) - self.logger.debug(output) return output def commit(self, message='commit message'): + LOG.debug('committing %r', message) self.git('add', '.') self.git('commit', '-m', message) sha = self.git('log', '-n', '1', '--pretty=format:%H') + LOG.debug('SHA: %r', sha) return sha.decode('utf-8').strip() def add_file(self, name): + LOG.debug('adding file %r', name) with open(os.path.join(self.path, name), 'w') as f: f.write('adding %s\n' % name) return self.commit('add %s' % name) def tag(self, version): + LOG.debug('tagging %r', version) self.git('tag', '-s', '-m', version, version)