def test_collecting_units_recurse(self): test_dir = join(self.test_dir, 'test_app', 'test') ensure_dir(test_dir) with open(join(test_dir, 'level1.erl'), 'w') as test: test.write(''' -module(level1). -include_lib("eunit/include/eunit.hrl"). run_test() -> ?_assert(true).''') subdir = join(test_dir, 'sub') ensure_dir(subdir) with open(join(subdir, 'level2.erl'), 'w') as test: test.write(''' -module(level2). -include_lib("eunit/include/eunit.hrl"). run_test() -> ?_assert(true).''') package = Package.from_path(join(self.test_dir, 'test_app')) compiler = EnotCompiler(package) files = compiler._EnotCompiler__get_all_files(compiler.test_path, 'erl') self.assertEqual({ 'level1': test_dir, 'level2': join(test_dir, 'sub') }, files)
def test_collecting_units(self): test_dir = join(self.test_dir, 'test_app', 'test') ensure_dir(test_dir) with open(join(test_dir, 'first.erl'), 'w') as test: test.write(''' -module(first). -include_lib("eunit/include/eunit.hrl"). run_test() -> ?_assert(true).''') with open(join(test_dir, 'second.erl'), 'w') as test: test.write(''' -module(second). -include_lib("eunit/include/eunit.hrl"). run_test() -> ?_assert(true).''') package = Package.from_path(join(self.test_dir, 'test_app')) compiler = EnotCompiler(package) files = compiler._EnotCompiler__get_all_files(compiler.test_path, 'erl') self.assertEqual({'first': test_dir, 'second': test_dir}, files)