On Tue, 2019-05-21 at 14:01 +0200, Pino Toscano wrote: > For each OS, check two things: > - release-date/eol-date are actually valid dates; this is needed > because > the schema just specifies the regex, and it cannot detect invalid > dates such as "2019-05-00" or 2019-05-40" > - if both release-date/eol-date are specified, eol-date must be later > than release-date > --- > tests/test_dates.py | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > create mode 100644 tests/test_dates.py > > diff --git a/tests/test_dates.py b/tests/test_dates.py > new file mode 100644 > index 0000000..60f70e6 > --- /dev/null > +++ b/tests/test_dates.py > @@ -0,0 +1,22 @@ > +# This work is licensed under the GNU GPLv2 or later. > +# See the COPYING file in the top-level directory. > + > +import datetime > + > +import pytest There's no need to import pytest here. > + > +from . import util > + > + > +def _parse_date(date_string): > + if not date_string: > + return None > + return datetime.date.fromisoformat(date_string) With the change suggested in the first patch, you can just ditch this method ... > + > + > +@pytest.mark.parametrize('os', util.DataFiles.oses()) Here, I'd suggest to use `@util.os_parametrize('osxml', filter_dates=True)` and then un util.py just add a new filter_dates that would be something like: oses = [o for o in oses if o.release_date and o.eol_date] This will make the test to run only against the entries that have release and eol date, instead of running against every entry we have. Of course, by doing this you'll have to adjust os -> osxml. > +def test_dates(os): > + release_date = _parse_date(os.release_date) > + eol_date = _parse_date(os.eol_date) ... and just call datetime.data.fromisoformat() directly here > + if release_date and eol_date: > + assert release_date < eol_date _______________________________________________ Libosinfo mailing list Libosinfo@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libosinfo