Coverage for tests/test_cli/test_fetch.py: 100%

13 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2024-04-28 15:17 +0000

1from pathlib import Path 

2 

3from click.testing import Result 

4 

5from prisma import config 

6from prisma._config import Config 

7 

8from ..utils import Runner, set_config 

9 

10 

11def assert_success(result: Result) -> None: 

12 assert result.exit_code == 0 

13 assert result.output.endswith(f'Downloaded binaries to {config.binary_cache_dir}\n') 

14 

15 

16def test_fetch(runner: Runner) -> None: 

17 """Basic usage, binaries are already cached""" 

18 assert_success(runner.invoke(['py', 'fetch'])) 

19 

20 

21def test_fetch_not_cached(runner: Runner, tmp_path: Path) -> None: 

22 """Basic usage, binaries are not cached""" 

23 with set_config(Config.parse(binary_cache_dir=tmp_path)): 

24 assert_success(runner.invoke(['py', 'fetch']))