def test_should_only_return_py_suffix(self): when(os).walk("spam").thenReturn([("spam", [], self.fake_dir_contents) ]) expected_result = ["spam/spam.py", "spam/eggs.py"] actual_result = set(discover_files("spam", ".py")) self.assertEquals(set(expected_result), actual_result) verify(os).walk("spam")
def test_should_only_return_py_suffix(self): when(os).walk("spam").thenReturn([("spam", [], self.fake_dir_contents)]) expected_result = ["spam/spam.py", "spam/eggs.py"] actual_result = set(discover_files("spam", ".py")) self.assertEquals(set(expected_result), actual_result) verify(os).walk("spam")
def test_should_only_return_py_suffix(self, walk): expected_result = ["spam/spam.py", "spam/eggs.py"] actual_result = set(discover_files("spam", ".py")) self.assertEquals(set(expected_result), actual_result) walk.assert_called_with("spam")
def discover_python_files(directory): return discover_files(directory, ".py")