66
77TEST_MODELS_DIR = os .path .join (os .path .dirname (__file__ ), ".." , "test_models" )
88
9+ # Semantic errors that the parser cannot detect (only syntax errors are caught)
10+ SEMANTIC_ERROR_FILES = {
11+ "missingreference.uvl" ,
12+ "wrong_attribute_name.uvl" ,
13+ "same_feature_names.uvl" ,
14+ }
15+
916
1017def get_valid_files ():
1118 all_files = glob .glob (os .path .join (TEST_MODELS_DIR , "**" , "*.uvl" ), recursive = True )
1219 return [f for f in all_files if os .sep + "faulty" + os .sep not in f ]
1320
1421
15- def get_faulty_files ():
16- return glob .glob (os .path .join (TEST_MODELS_DIR , "faulty" , "*.uvl" ))
22+ def get_faulty_syntax_files ():
23+ """Only return files with syntax errors (not semantic errors)."""
24+ all_faulty = glob .glob (os .path .join (TEST_MODELS_DIR , "faulty" , "*.uvl" ))
25+ return [f for f in all_faulty if os .path .basename (f ) not in SEMANTIC_ERROR_FILES ]
1726
1827
1928def relative_path (file ):
@@ -26,7 +35,7 @@ def test_valid_model(uvl_file):
2635 assert tree is not None
2736
2837
29- @pytest .mark .parametrize ("uvl_file" , get_faulty_files (), ids = relative_path )
38+ @pytest .mark .parametrize ("uvl_file" , get_faulty_syntax_files (), ids = relative_path )
3039def test_faulty_model (uvl_file ):
3140 with pytest .raises (Exception ):
3241 get_tree (uvl_file )
0 commit comments