2 # This file and its contents are supplied under the terms of the
3 # Common Development and Distribution License ("CDDL"), version 1.0.
4 # You may only use this file in accordance with the terms of version
7 # A full copy of the text of the CDDL should have accompanied this
8 # source. A copy of the CDDL is also available via the Internet at
9 # http://www.illumos.org/license/CDDL.
13 # Copyright 2023 Marcel Telka
16 %patch% 01-test-reqs.patch
17 %patch% 02-test-no-cov.patch
18 %patch% 03-test-no-pytest-codspeed.patch
21 # This project does not support tox so we need to provide test requirements
23 TEST_REQUIREMENTS += requirements/test.txt
26 # Tests are run from build directory that contains cloned copy of sdist. We
27 # try to ask Python to find tested modules in the proto area (the PYTHONPATH is
28 # set accordingly), but Python (< 3.11) always adds the current directory to
29 # sys.path and there is no known (simple) way how to avoid that. Except -I,
30 # but that would cause Python to ignore PYTHONPATH too so we would not have
31 # access to the proto area either. The -P option together with PYTHONSAFEPATH
32 # environment variable were added to Python 3.11 only so we cannot use them yet
33 # for all Python versions we support.
35 # Since sdist for this project contains the main module in the top-level
36 # directory we cannot force Python to skip it. But, unfortunately, this module
37 # does not contain built dynamic libraries, so Python cannot find them while
40 # To workaround this we rename the main module in the build directory during
41 # testing so Python will need to defer to PYTHONPATH.
43 COMPONENT_PRE_TEST_ACTION += $(MV) $(@D)/yarl $(@D)/yarl-RENAMED ;
44 COMPONENT_POST_TEST_ACTION += $(MV) $(@D)/yarl-RENAMED $(@D)/yarl ;
46 # We have no pytest-codspeed packaged yet.
47 PYTEST_ADDOPTS += --ignore tests/test_quoting_benchmarks.py
48 PYTEST_ADDOPTS += --ignore tests/test_url_benchmarks.py
50 # Random directory name
51 COMPONENT_TEST_TRANSFORMS += "-e 's|/tmp/.*/garbage[^/]*|\$$(TMPDIR)|'"