https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240476
--- Comment #16 from Michael Gmelin <gre...@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>=1.2.1, RUN_DEPENDS > says >=1.0. *_DEPENDS should match upstream > requirements as closely as possible modulo any > syntax limitations we have (we cant foo!=x.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 automatically? > 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 > decorators upstreams can use to do this > with various condition support) Yes, that is what the pytest change did using conftest.py, by excluding whole files, as linux_test.py was incompatible on import (not just when running the 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 things 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 != 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. > 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=g-import-not-at-top else: import unittest So one more iteration to improve *_DEPENDS and we should be done for now :) -- You are receiving this mail because: You are the assignee for the bug. _______________________________________________ freebsd-python@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-python To unsubscribe, send any mail to "freebsd-python-unsubscr...@freebsd.org"