@@ -27,15 +27,27 @@ def test_read_from_csv(test_app):
2727 check_transaktion_list (transaction_list )
2828
2929
30- def test_read_from_pdf (test_app ):
30+ # Look for test files and create a tuple list
31+ test_folder = os .path .join ('/tmp' , 'volksbank-mittelhessen' )
32+ test_files = []
33+ if not os .path .isdir (test_folder ):
34+ test_files = [()]
35+ else :
36+ for file in os .listdir (test_folder ):
37+ test_files .append (
38+ (os .path .join (test_folder , file ))
39+ )
40+
41+ # Using every test file in its own test
42+ @pytest .mark .parametrize ("full_path" , test_files )
43+ def test_read_from_pdf (test_app , full_path ):
3144 """Testet das Einlesen einer PDF Datei mit Kontoumsätzen"""
32- test_file_pdf = os .path .join ('/tmp' , 'volksbank-mittelhessen.pdf' )
33- if not os .path .isfile (test_file_pdf ):
34- # Test file not provided (sensitive data is not part of git repo)
35- pytest .skip ("Testfile /tmp/volksbank-mittelhessen.pdf not found....skipping" )
45+ if not full_path :
46+ # Test files not provided (sensitive data is not part of git repo)
47+ pytest .skip ("Testfile not provided....skipping" )
3648
3749 with test_app .app_context ():
38- transaction_list = Volksbank_Mittelhessen ().from_pdf (test_file_pdf )
50+ transaction_list = Volksbank_Mittelhessen ().from_pdf (full_path )
3951
4052 # Check Reader Ergebnisse
4153 check_transaktion_list (transaction_list )
0 commit comments