def test_domain_files_are_not_conversation_tests(tmpdir: Path): parent = tmpdir / DEFAULT_E2E_TESTS_PATH Path(parent).mkdir(parents=True) domain_path = parent / "domain.yml" assert not data.is_test_stories_file(str(domain_path))
def test_default_conversation_tests_are_conversation_tests_yml(tmpdir: Path): parent = tmpdir / DEFAULT_E2E_TESTS_PATH Path(parent).mkdir(parents=True) e2e_path = parent / "test_stories.yml" e2e_story = """stories:""" write_text_file(e2e_story, e2e_path) assert data.is_test_stories_file(str(e2e_path))
def test_default_conversation_tests_are_conversation_tests_md(tmpdir: Path): # can be removed once conversation tests MD support is removed parent = tmpdir / DEFAULT_E2E_TESTS_PATH Path(parent).mkdir(parents=True) e2e_path = parent / "conversation_tests.md" e2e_story = """## my story test""" write_text_file(e2e_story, e2e_path) assert data.is_test_stories_file(str(e2e_path))
def test_nlu_data_files_are_not_conversation_tests(tmpdir: Path): parent = tmpdir / DEFAULT_E2E_TESTS_PATH Path(parent).mkdir(parents=True) nlu_path = parent / "nlu.md" nlu_data = """ ## intent: greet - hello - hi - hallo """ write_text_file(nlu_data, nlu_path) assert not data.is_test_stories_file(str(nlu_path))
def _init_from_directory(self, path: Text): for parent, _, files in os.walk(path, followlinks=True): for file in files: full_path = os.path.join(parent, file) if not self.is_imported(full_path): # Check next file continue if data.is_test_stories_file(full_path): self._e2e_story_paths.append(full_path) elif Domain.is_domain_file(full_path): self._domain_paths.append(full_path) elif data.is_nlu_file(full_path): self._nlu_paths.append(full_path) elif data.is_story_file(full_path): self._story_paths.append(full_path) elif data.is_config_file(full_path): self._init_from_file(full_path)