Coverage for rust2rpm/tests/test_utils.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.6.7, created at 2024-11-26 13:52 +0100

1from importlib import resources 

2from pathlib import Path 

3 

4import pytest 

5 

6from rust2rpm.utils import detect_editor, guess_crate_name 

7 

8 

9def test_detect_editor(): 

10 detect_editor() 

11 

12 

13@pytest.mark.parametrize( 

14 ("directory", "name"), 

15 [ 

16 ("rust-foo", "foo"), 

17 ("rust-bar", "bar"), 

18 ("rust-baz0.1", "baz"), 

19 ], 

20 ids=repr, 

21) 

22def test_guess_crate_name(directory: str, name: str): 

23 path = Path(str(resources.files("rust2rpm.tests.data.fixtures").joinpath(directory))) 

24 assert guess_crate_name(path) == name