Example #1
0
def make_converters(cwd=None):
    """For items that need coaxing into their internal representations."""
    return {
        'exclude': lambda v: file_utils.expand_source_files(v, cwd),
        'inputs': lambda v: file_utils.expand_source_files(v, cwd),
        'output': lambda v: file_utils.expand_path(v, cwd),
        'pythonpath': lambda v: file_utils.expand_pythonpath(v, cwd),
    }
Example #2
0
 def test_strip_whitespace(self):
     self.assertEqual(
         file_utils.expand_pythonpath("""
   a/b:
   c/d
 """), [
             os.path.join(os.getcwd(), "a", "b"),
             os.path.join(os.getcwd(), "c", "d")
         ])
Example #3
0
 def test_expand_with_cwd(self):
     with file_utils.Tempdir() as d:
         self.assertEqual(
             file_utils.expand_pythonpath("a/b%sc/d" % os.pathsep,
                                          cwd=d.path),
             [
                 os.path.join(d.path, "a", "b"),
                 os.path.join(d.path, "c", "d")
             ])
Example #4
0
def make_converters(cwd=None):
  """For items that need coaxing into their internal representations."""
  return {
      'exclude': lambda v: file_utils.expand_source_files(v, cwd),
      'keep_going': string_to_bool,
      'inputs': lambda v: file_utils.expand_source_files(v, cwd),
      'output': lambda v: file_utils.expand_path(v, cwd),
      'python_version': get_python_version,
      'pythonpath': lambda v: file_utils.expand_pythonpath(v, cwd),
      'disable': concat_disabled_rules,
  }
Example #5
0
 def test_expand_current_directory(self):
     self.assertEqual(
         file_utils.expand_pythonpath("%sa" % os.pathsep),
         [os.getcwd(), os.path.join(os.getcwd(), "a")])
Example #6
0
 def test_expand_empty(self):
     self.assertEqual(file_utils.expand_pythonpath(""), [])
Example #7
0
 def test_expand(self):
     self.assertEqual(file_utils.expand_pythonpath("a/b%sc/d" % os.pathsep),
                      [
                          os.path.join(os.getcwd(), "a", "b"),
                          os.path.join(os.getcwd(), "c", "d")
                      ])