**Try** to extract all available EBDs by introducing dynamic test parametrization#8
**Try** to extract all available EBDs by introducing dynamic test parametrization#8
Conversation
fun fun fun
Co-authored-by: Leon Haffmans <49658102+lord-haffi@users.noreply.github.com>
| @pytest.mark.parametrize( | ||
| "get_ebd_keys_and_files", | ||
| [ | ||
| pytest.param( | ||
| "ebd20221128.docx", # this is used as positional argument for the indirect fixture | ||
| ), | ||
| ], | ||
| indirect=["get_ebd_keys_and_files"], | ||
| ) | ||
| def test_extraction(self, datafiles, get_ebd_keys_and_files: List[Tuple[str, str]], subtests): | ||
| """ | ||
| tests the extraction and conversion without specific assertions | ||
| """ | ||
| for ebd_key, filename in get_ebd_keys_and_files: | ||
| # I tried for 1.5h to dynamically create test cases for each entry but the parametrization really f***ed me | ||
| with subtests.test(ebd_key): |
There was a problem hiding this comment.
Was passiert hier denn für 'ne Magie? ^^
Ist datafiles jetzt auch "ebd20221128.docx"? Hier wäre vielleicht ein bisschen mehr Aufklärung (für mich) wünschenswert, was pytest da genau macht. Und was subtests ist. Ich nehme mal an, dass das irgendein Feature von pytest ist?
There was a problem hiding this comment.
es ist eine eigene fixture mit indirect parametrization (siehe ganz oben in der datei), kombiniert mit einem pytest-plugin.
| assert isinstance(actual, EbdTable) | ||
| except Exception as error: | ||
| error_msg = f"Error while scraping '{ebd_key}': {str(error)}" | ||
| pytest.skip(error_msg) |
There was a problem hiding this comment.
Gibt's hier keine Möglichkeit bei den Subtests 'nen Fehler zu schmeißen statt eines skips?
There was a problem hiding this comment.
Ahso, haste hier nen Skip, damit du pushen kannst ohne direkt alles perfekt zu fixen? ^^ Dann vielleicht nen TODO kommentieren.
There was a problem hiding this comment.
nen Fehler zu schmeißen statt eines skips?
ja. den try/catch block ausbauen :D
There was a problem hiding this comment.
Dieser PR führt einen Unittest ein, der es ermöglicht, schnell einen überblick zu bekommen, was gerade noch hängt und warum:
die idee ist, dass dieser test einen überblick gibt, was geht und was nicht geht und die einzelnen so gefundenen problem, dann einzeln (in eigenen tests) adressiert werden können.