Coverage for tests/test_run.py: 100%

15 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-09-27 09:52 +0000

1""" 

2This module contains an example test. 

3 

4Tests should be placed in ``src/tests``, in modules that mirror your 

5project's structure, and in files named test_*.py. They are simply functions 

6named ``test_*`` which test a unit of logic. 

7 

8To run the tests, run ``kedro test`` from the project root directory. 

9""" 

10 

11from pathlib import Path 

12 

13import pytest 

14 

15from kedro.framework.project import settings 

16from kedro.config import ConfigLoader 

17from kedro.framework.context import KedroContext 

18from kedro.framework.hooks import _create_hook_manager 

19 

20 

21@pytest.fixture 

22def config_loader(): 

23 return ConfigLoader(conf_source=str(Path.cwd() / settings.CONF_SOURCE)) 

24 

25 

26@pytest.fixture 

27def project_context(config_loader): 

28 return KedroContext( 

29 package_name="quafel", 

30 project_path=Path.cwd(), 

31 config_loader=config_loader, 

32 hook_manager=_create_hook_manager(), 

33 ) 

34 

35 

36# The tests below are here for the demonstration purpose 

37# and should be replaced with the ones testing the project 

38# functionality 

39class TestProjectContext: 

40 def test_project_path(self, project_context): 

41 assert project_context.project_path == Path.cwd()