Package tests :: Module test_PristineTar

[hide private]
[frames] | no frames]

# Module test_PristineTar

Test pristine-tar related methods in

- gbp.deb.DebianPristineTar

and

- gbp.deb.git.DebianGitRepository

This testcase creates this reposity:

- A repository at repo_dir called repo

Functions | [hide private]

test_create() Create a repository |

test_empty_repo() Empty repos have no branch pristine-tar branch |

test_commit_dir() Empty repos have no branch pristine-tar branch |

test_create_tarball() Create a tarball from a git tree |

test_pristine_tar_commit() Commit the delta to the pristine-tar branch |

test_pristine_has_commit() Find delta on the pristine tar branch |

test_pristine_tar_checkout() Checkout a tarball using pristine-tar |

test_teardown() Perform the teardown |

Variables | [hide private]

| repo_dir = ``'``/tmp/tmpQdcrwNgbp_tests.test_PristineTar_/repo``'``
| test_data = ``'``/build/buildd/git-buildpackage-0.6.9/tests/test_P``...``
| __package__ = ``'``tests``'``

Function Details | [hide private]

### test_create()

Create a repository

Methods tested:

- gbp.deb.git.DebianGitRepository.create

    >>> import os, gbp.deb.git
    >>> repo = gbp.deb.git.DebianGitRepository.create(repo_dir)

### test_empty_repo()

Empty repos have no branch pristine-tar branch

Methods tested:

- gbp.deb.git.DebianGitRepository.has_pristine_tar_branch
- gbp.deb.pristinetar.DebianPristineTar.has_commit

    >>> import gbp.deb.git
    >>> repo = gbp.deb.git.DebianGitRepository(repo_dir)
    >>> repo.has_pristine_tar_branch()
    False
    >>> repo.pristine_tar.has_commit('upstream', '1.0', 'gzip')
    False

### test_commit_dir()

Empty repos have no branch pristine-tar branch

Methods tested:

- gbp.git.repository.GitRepository.commit_dir
- gbp.git.repository.GitRepository.create_branch

    >>> import gbp.deb.git
    >>> repo = gbp.deb.git.DebianGitRepository(repo_dir)
    >>> commit = repo.commit_dir(test_data, msg="initial commit", branch=None)
    >>> repo.create_branch('upstream')

### test_create_tarball()

Create a tarball from a git tree

Methods tested:

- gbp.deb.git.DebianGitRepository.archive

    >>> import gbp.deb.git
    >>> repo = gbp.deb.git.DebianGitRepository(repo_dir)
    >>> repo.archive('tar', 'upstream/', '../upstream_1.0.orig.tar', 'upstream')
    >>> gbp.command_wrappers.Command('gzip', [ '-n', '%s/../upstream_1.0.orig.tar' % repo_dir])()

### test_pristine_tar_commit()

Commit the delta to the pristine-tar branch

Methods tested:

- gbp.deb.pristinetar.DebianPristineTar.commit

    >>> import gbp.deb.git
    >>> repo = gbp.deb.git.DebianGitRepository(repo_dir)
    >>> repo.pristine_tar.commit('../upstream_1.0.orig.tar.gz', 'upstream')

### test_pristine_has_commit()

Find delta on the pristine tar branch

Methods tested:

- gbp.deb.pristinetar.DebianPristineTar.has_commit
- gbp.pkg.pristinetar.PristineTar.get_commit

    >>> import gbp.deb.git
    >>> repo = gbp.deb.git.DebianGitRepository(repo_dir)
    >>> repo.pristine_tar.has_commit('upstream', '1.0', 'bzip2')
    False
    >>> repo.pristine_tar.has_commit('upstream', '1.0', 'gzip')
    True
    >>> repo.pristine_tar.has_commit('upstream', '1.0')
    True
    >>> branch = repo.rev_parse('pristine-tar')
    >>> commit = repo.pristine_tar.get_commit('upstream_1.0.orig.tar.gz')
    >>> branch == commit
    True

### test_pristine_tar_checkout()

Checkout a tarball using pristine-tar

Methods tested:

- gbp.deb.pristinetar.DebianPristineTar.checkout

    >>> import gbp.deb.git
    >>> repo = gbp.deb.git.DebianGitRepository(repo_dir)
    >>> repo.pristine_tar.checkout('upstream', '1.0', 'gzip', '..')

### test_teardown()

Perform the teardown

    >>> context.teardown()

Variables Details | [hide private]

### test_data

Value:

      '/build/buildd/git-buildpackage-0.6.9/tests/test_PristineTar_data'