Skip to content

Test which relies on XML file fails #687

@nesnoj

Description

@nesnoj

Description of the issue

(At least) the tests which rely on XML file fail. This is probably caused by the partial XML file download which only contains some technologies. However, test_read_xml_file() tries to read "EinheitenKernkraft" (develop) or "EinheitenStromVerbraucher" (622-deprecate-api-download)

Steps to Reproduce

  1. Delete the DB and XML files
  2. Run pytest -> 29 passed, 5 skipped
  3. Run pytest again -> test_read_xml_file() fails:

Message from 622-deprecate-api-download:

zipped_xml_file_path = '/SOME/PATH/.open-MaStR/data/xml_download/Gesamtdatenexport_20251208.zip'                                                                                                                  
                                                                                                                                                                                                                                             
    @pytest.mark.skipif(                                                                                                                                                                                                                     
        not _xml_file_exists, reason="The zipped xml file could not be found."                                                                                                                                                               
    )                                                                                                                                                                                                                                        
    def test_read_xml_file(zipped_xml_file_path):                                                                                                                                                                                            
        file_name = "EinheitenStromVerbraucher"                                                                                                                                                                                              
        with ZipFile(zipped_xml_file_path, "r") as f:                                                                                                                                                                                        
>           df = read_xml_file(f, f"{file_name}.xml")                                                                                                                                                                                        
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Ideas of solution

I propose to

  • replace this skipping by a clear dependency like here
  • change the xml name to a file which is downloaded in the dependency, e.g. "EinheitenWind.xml" OR add the files to the download.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions