| """ |
| This module contains an example test. |
| |
| Tests should be placed in ``src/tests``, in modules that mirror your |
| project's structure, and in files named test_*.py. They are simply functions |
| named ``test_*`` which test a unit of logic. |
| """ |
| |
| from pathlib import Path |
| |
| import pytest |
| from kedro.config import OmegaConfigLoader |
| from kedro.framework.context import KedroContext |
| from kedro.framework.hooks import _create_hook_manager |
| |
| |
| @pytest.fixture |
| def config_loader(): |
| return OmegaConfigLoader(conf_source=str(Path.cwd())) |
| |
| |
| @pytest.fixture |
| def project_context(config_loader): |
| return KedroContext( |
| package_name="kedro_code", |
| project_path=Path.cwd(), |
| config_loader=config_loader, |
| hook_manager=_create_hook_manager(), |
| ) |
| |
| |
| # The tests below are here for the demonstration purpose |
| # and should be replaced with the ones testing the project |
| # functionality |
| class TestProjectContext: |
| def test_project_path(self, project_context): |
| assert project_context.project_path == Path.cwd() |