[Libosinfo] [osinfo-db PATCH 2/2] tests: add a new test for dates

Pino Toscano ptoscano at redhat.com
Tue May 21 13:34:19 UTC 2019


On Tuesday, May 21, 2019 2:39:37 PM CEST Fabiano Fidêncio wrote:
> So, in the end, my suggestion is to add to this patches something like:
> ```
> fidencio at laerte ~/src/upstream/osinfo-db $ git diff
> diff --git a/tests/test_dates.py b/tests/test_dates.py
> index 60f70e6..aa8db17 100644
> --- a/tests/test_dates.py
> +++ b/tests/test_dates.py
> @@ -3,8 +3,6 @@
>  
>  import datetime
>  
> -import pytest
> -
>  from . import util
>  
>  
> @@ -14,9 +12,9 @@ def _parse_date(date_string):
>      return datetime.date.fromisoformat(date_string)
>  
>  
> - at pytest.mark.parametrize('os', util.DataFiles.oses())
> -def test_dates(os):
> -    release_date = _parse_date(os.release_date)
> -    eol_date = _parse_date(os.eol_date)
> + at util.os_parametrize('osxml', filter_dates=True)
> +def test_dates(osxml):
> +    release_date = _parse_date(osxml.release_date)
> +    eol_date = _parse_date(osxml.eol_date)
>      if release_date and eol_date:
>          assert release_date < eol_date
> diff --git a/tests/util.py b/tests/util.py
> index 19728a4..b5dcd8b 100644
> --- a/tests/util.py
> +++ b/tests/util.py
> @@ -84,6 +84,8 @@ class _Files():
>              oses = [o for o in oses if o.devices]
>          if filter_resources:
>              oses = [o for o in oses if o.resources_list]
> +        if filter_dates:
> +            oses = [o for o in oses if o.release_date or o.eol_date]
>          return oses
>  
>      def getosxml_related(self, osxml):
> ```
> 
> If I get your ack on this, I can just squash the patch into yours and
> push without the need of a v2.

LGTM, thanks.

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libosinfo/attachments/20190521/4091b374/attachment.sig>


More information about the Libosinfo mailing list