Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Sep 2019 11:26:24 +0000
From:      bugzilla-noreply@freebsd.org
To:        python@FreeBSD.org
Subject:   [Bug 240476] security/py-fido2: Add FreeBSD support
Message-ID:  <bug-240476-21822-5i2bke8Rju@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-240476-21822@https.bugs.freebsd.org/bugzilla/>
References:  <bug-240476-21822@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D240476

--- Comment #16 from Michael Gmelin <grembo@FreeBSD.org> ---
(In reply to Kubilay Kocak from comment #15)

Hi Koobs,

> A couple of leftovers:

> - RUN_DEPENDS don't also need to be in TEST_DEPENDS
>   (uhid-freebsd)
> - setup.py says uhid-freebsd>=3D1.2.1, RUN_DEPENDS
>   says >=3D1.0. *_DEPENDS should match upstream
>   requirements as closely as possible modulo any
>   syntax limitations we have (we cant foo!=3Dx.y
>   right now for example)

I will change those. Interestingly I couldn't find any mention of that fact=
 in
the porters handbook, also, this sounds like something that could be added =
to
`portlint' quite easily.

Do we have any tooling for extracting such details from setup.py automatica=
lly?

> On the test suite with OS specific tests,
> upstreams should always 'skip' these tests
> if the environment isn't appropriate for
> the test. pytest and nose have very easy=20
> decorators upstreams can use to do this
> with various  condition support)

Yes, that is what the pytest change did using conftest.py, by excluding who=
le
files, as linux_test.py was incompatible on import (not just when running t=
he
tests) as pyfakefs was missing.

> When test suites 'dont' skip inappropriate
> tests, one can usually (with most unittest
> frameworks), skip individual tests explicitly
> in the test invocation.
> For example with pytest you can
> -k 'not <expression>' and with nose you can
> - > {xclude} <regex>

My first attempt was to do that in `do-test', by running `pytest -k' on the
tests directory and excluding those offending files, which worked okay.

But running `setup.py test' seems cleaner (IMHO) as it will pick up more th=
ings
specific to the project and once it became clear that I'll aim to upstream =
it,
I wanted a solution that worked outside of the ports framework and allowed
those who want to improve the library to start right away.

Also, obviously the added FreeBSD unit tests shouldn't interfere with
upstream's CI. Introducing pytest or nose to the project would've made that
easier, but they had valid reasons not to do that.

> With unittest (in Python > 3.1) you can
> skipIf [1], i cant recall if there's
> a command line arg for skipping tests.

This is exactly what the patch that was upstreamed does - it uses @skipIf on
the platform specific test case classes:

  @unittest.skipIf(not sys.platform.startswith('linux'),
                   'Linux specific test case')
  class LinuxTest(unittest.TestCase):

That, plus an extra catch on importing pyfakefs that ignores the exception =
if
the file is imported on a platform !=3D Linux.

  try:
    from fakefs import fake_filesystem
  except ImportError:
    if sys.platform.startswith('linux'):
      raise

Not as clean as excluding the file completely, but it works.=20

> Also, if the tests use 'unittest',
> then the Python package should
> probably tests_require on
> "unittest2;python_version < 3"

unittest2 is only required for versions of python < 2.7 in this project, so=
 it
should be okay (poudriere on FreeBSD and Travis CI on Linux agree):

  if sys.version_info[:2] < (2, 7):
      import unittest2 as unittest  # pylint: disable=3Dg-import-not-at-top
  else:
      import unittest

So one more iteration to improve *_DEPENDS and we should be done for now :)

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-240476-21822-5i2bke8Rju>