diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..7286b20 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,38 @@ +name: Build and test + +on: + push: + branches: + - main + + pull_request: + branches: + - main + +jobs: + build_and_test: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Build and install package + run: | + python -m pip install .[tests] + + - name: Download testdata + run: | + wget -i testfiles.txt -P data + + - name: Unzip all testdata + run: | + unzip -d data -o 'data/*.zip' + + - name: Run tests + run: | + pytest \ No newline at end of file diff --git a/README.md b/README.md index d577a8e..9e02434 100644 --- a/README.md +++ b/README.md @@ -55,5 +55,10 @@ To build the package yourself instead of installing the `.whl`, simply clone the python -m build ``` +or you can simply install the package by running +``` +python -m pip install . +``` + ## Codegen These bindings are mostly generated using [xsData](https://xsdata.readthedocs.io) with some minor changes where needed. See commit history for these changes. \ No newline at end of file diff --git a/pyeml_bindings_testreport.html b/pyeml_bindings_testreport.html deleted file mode 100644 index e6c57dc..0000000 --- a/pyeml_bindings_testreport.html +++ /dev/null @@ -1,1091 +0,0 @@ - - - - - pyeml_bindings_testreport.html - - - - -

pyeml_bindings_testreport.html

-

Report generated on 02-Nov-2023 at 15:47:08 by pytest-html - v4.0.2

-
-

Environment

-
-
- - - - - -
-
-

Summary

-
-
-

3084 tests took 01:31:21.

-

(Un)check the boxes to filter the results.

-
- -
-
-
-
- - 4 Failed, - - 3080 Passed, - - 0 Skipped, - - 0 Expected failures, - - 0 Unexpected passes, - - 0 Errors, - - 0 Reruns -
-
-  /  -
-
-
-
-
-
-
-
- - - - - - - - - -
ResultTestDurationLinks
- - - \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index afd0e07..7422ba8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,12 +5,12 @@ build-backend = "hatchling.build" [project] name = "pyeml_bindings" description = "Data bindings for the EML_NL Standard" -version = "1.0.0" +version = "1.0.1" authors = [{name = "Chris Mostert", email = "chris.mostert@kiesraad.nl"}] readme = "README.md" requires-python = ">=3.10" dependencies = [ - "xsdata == 23.*" + "xsdata == 24.*" ] license = {file = "LICENSE"} classifiers = [ diff --git a/testfiles.txt b/testfiles.txt new file mode 100644 index 0000000..e6f6fdc --- /dev/null +++ b/testfiles.txt @@ -0,0 +1,3 @@ +https://data.overheid.nl/sites/default/files/dataset/e3fe6e42-06ab-4559-a466-a32b04247f68/resources/Verkiezingsuitslag%20Tweede%20Kamer%202023%20%28Deel%201%29.zip +https://data.overheid.nl/sites/default/files/dataset/e3fe6e42-06ab-4559-a466-a32b04247f68/resources/Verkiezingsuitslag%20Tweede%20Kamer%202023%20%28Deel%202%29.zip +https://data.overheid.nl/sites/default/files/dataset/e3fe6e42-06ab-4559-a466-a32b04247f68/resources/Verkiezingsuitslag%20Tweede%20Kamer%202023%20%28Deel%203%29.zip \ No newline at end of file diff --git a/tests/test_roundtrip.py b/tests/test_roundtrip.py index 3d13fde..46b7618 100644 --- a/tests/test_roundtrip.py +++ b/tests/test_roundtrip.py @@ -1,16 +1,17 @@ +import glob +import itertools +import re +import xml.etree.ElementTree as ET from pathlib import Path + +import pytest +from formencode.doctest_xml_compare import xml_compare from xsdata.formats.dataclass.parsers import XmlParser from xsdata.formats.dataclass.parsers.config import ParserConfig from xsdata.formats.dataclass.serializers import XmlSerializer + from pyeml_bindings import Eml110a, Eml230, Eml510, Eml520 from pyeml_bindings.namespace import NAMESPACE -import xml.etree.ElementTree as ET -from formencode.doctest_xml_compare import xml_compare -from sys import stdout -import pytest -import itertools -import glob -import re def parsing_roundtrip_same(parser, serializer, reporter, path_to_eml, type) -> bool: @@ -28,7 +29,7 @@ def parsing_roundtrip_same(parser, serializer, reporter, path_to_eml, type) -> b parser = XmlParser(ParserConfig(fail_on_unknown_properties=False)) serializer = XmlSerializer() reporter = print -files = glob.glob(f"data/**/*.eml.xml", recursive=True) +files = glob.glob("data/**/*.eml.xml", recursive=True) test_cases = zip( itertools.repeat(parser), @@ -49,6 +50,11 @@ def parsing_roundtrip_same(parser, serializer, reporter, path_to_eml, type) -> b ) def test_roundtrip(parser, serializer, reporter, file): name = Path(file).name + + # Skip known invalid EML file from TK2023 + if name == "Telling_TK2023_NBSB.eml.xml": + pytest.skip(f"Skipping known invalid EML file {name}") + if p_110a.match(name): assert parsing_roundtrip_same(parser, serializer, reporter, file, Eml110a) elif p_230.match(name):