File: test_lib.py

package info (click to toggle)
dfwinreg 20160428-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,820 kB
  • ctags: 461
  • sloc: python: 4,265; makefile: 59
file content (28 lines) | stat: -rw-r--r-- 815 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
23
24
25
26
27
28
# -*- coding: utf-8 -*-
"""Windows Registry related functions and classes for testing."""

import os
import unittest


class WinRegTestCase(unittest.TestCase):
  """The unit test case for Windows Registry related object."""

  _TEST_DATA_PATH = os.path.join(os.getcwd(), u'test_data')

  # Show full diff results, part of TestCase so does not follow our naming
  # conventions.
  maxDiff = None

  def _GetTestFilePath(self, path_segments):
    """Retrieves the path of a test file relative to the test data directory.

    Args:
      path_segments: the path segments inside the test data directory.

    Returns:
      A path of the test file.
    """
    # Note that we need to pass the individual path segments to os.path.join
    # and not a list.
    return os.path.join(self._TEST_DATA_PATH, *path_segments)