11"""Tests for common utility functions"""
2+ from typing import cast
3+
24import pytest
5+ from _pytest .nodes import Item
36
47from pytest_rts .utils .common import filter_pytest_items , strip_pytest_cov_testname
58
2124 ),
2225 ],
2326)
24- def test_strip_pytest_cov_testname (testname , expected ) :
27+ def test_strip_pytest_cov_testname (testname : str , expected : str ) -> None :
2528 """Test pytest-cov testname stripping to actual pytest item.nodeid strings"""
2629 assert strip_pytest_cov_testname (testname ) == expected
2730
2831
29- def test_filter_pytest_items ():
32+ def test_filter_pytest_items () -> None :
3033 """Test for filtering the test set
3134 based on given existing tests
3235 """
@@ -49,16 +52,16 @@ def get_closest_marker(self, markername: str) -> bool:
4952 return False
5053
5154 collected_items = [
52- FakePytestItem ("test1" , "test_func_1" , "" ),
53- FakePytestItem ("test2" , "test_func_2" , "skip" ),
54- FakePytestItem ("test3" , "test_func_3" , "" ),
55- FakePytestItem ("test4" , "test_func_4" , "skipif" ),
56- FakePytestItem ("test5" , "test_func_5" , "" ),
55+ cast ( Item , FakePytestItem ("test1" , "test_func_1" , "" ) ),
56+ cast ( Item , FakePytestItem ("test2" , "test_func_2" , "skip" ) ),
57+ cast ( Item , FakePytestItem ("test3" , "test_func_3" , "" ) ),
58+ cast ( Item , FakePytestItem ("test4" , "test_func_4" , "skipif" ) ),
59+ cast ( Item , FakePytestItem ("test5" , "test_func_5" , "" ) ),
5760 ]
58- existing_tests = [
61+ existing_tests = {
5962 "test_func_1" ,
6063 "test_func_3" ,
61- ]
64+ }
6265
6366 filtered_items = filter_pytest_items (collected_items , existing_tests )
6467
0 commit comments