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), }
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") ])
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") ])
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, }
def test_expand_current_directory(self): self.assertEqual( file_utils.expand_pythonpath("%sa" % os.pathsep), [os.getcwd(), os.path.join(os.getcwd(), "a")])
def test_expand_empty(self): self.assertEqual(file_utils.expand_pythonpath(""), [])
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") ])