@@ -21,26 +21,37 @@ def test_file_exists(repo_path):
21
21
Test if a file exists.
22
22
23
23
Parameters:
24
- file_path (str): The path to the file to check.
24
+ repo_path (str): The path to the repository to check.
25
25
26
26
Returns:
27
- tuple: (success: bool, message: str )
27
+ tuple: (test_name: str, success: bool, message: list )
28
28
"""
29
29
30
30
test_name = "Checking if the mandatory files according to the contribution manual are present"
31
31
32
- mandatory_files = ["schema.json" , "examples/example.json" , "examples/example-normalized.json" , "examples/example.jsonld" , "examples/example-normalized.jsonld" , "notes.yaml" , "ADOPTERS.yaml" ]
32
+ mandatory_files = [
33
+ "schema.json" ,
34
+ "examples/example.json" ,
35
+ "examples/example-normalized.json" ,
36
+ "examples/example.jsonld" ,
37
+ "examples/example-normalized.jsonld" ,
38
+ "notes.yaml" ,
39
+ "ADOPTERS.yaml"
40
+ ]
33
41
output = []
34
42
success = True
43
+
35
44
for file in mandatory_files :
36
- path_to_file = repo_path + "/" + file
37
- # print(f"The path to file is {path_to_file}")
45
+ path_to_file = os .path .join (repo_path , file )
38
46
exist_file = os .path .exists (path_to_file )
39
47
success = success and exist_file
40
48
49
+ # Extract the file name from the path
50
+ file_name = os .path .basename (file )
51
+
41
52
if exist_file :
42
- output .append (f"The file { path_to_file } exists" )
53
+ output .append (f"The file { file_name } exists" )
43
54
else :
44
- output .append (f"*** The file { path_to_file } DOES NOT exist" )
45
- return test_name , success , output
55
+ output .append (f"*** The file { file_name } DOES NOT exist" )
46
56
57
+ return test_name , success , output
0 commit comments