File: test_util.py

package info (click to toggle)
git-ubuntu 1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,688 kB
  • sloc: python: 13,378; sh: 480; makefile: 2
file content (22 lines) | stat: -rw-r--r-- 737 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import os

import pkg_resources

import gitubuntu.git_repository


def get_test_changelog(name):
    """Create a Changelog object from a test case pkg_resources file

    Find the test case file in the source tree or shipped with the package,
    read it into a Changelog object, and return that object.

    :param str name: the name of the test case changelog file from the
        gitubuntu/changelog_tests/ directory in the source tree.
    :returns: the Changelog object constructed from the test case input file
    :rtype: gitubuntu.git_repository.Changelog
    """
    return gitubuntu.git_repository.Changelog.from_path(os.path.join(
        pkg_resources.resource_filename('gitubuntu', 'changelog_tests'),
        name,
    ))