Opened 3 years ago
Last modified 3 years ago
#64045 closed defect
py-pyzstd: tests fail from clean state because glob is used in global part of portfile — at Version 1
Reported by: | ryandesign (Ryan Carsten Schmidt) | Owned by: | catap (Kirill A. Korinsky) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | Cc: | ||
Port: | py-distorm py-gobject py-jellyfish py-ngl py-numeric py-plumed py-pyrfc3339 py-pyrsistent py-pyzstd py-xlsx2csv |
Description (last modified by ryandesign (Ryan Carsten Schmidt))
py-pyzstd does:
test.env PYTHONPATH=[glob -nocomplain ${worksrcpath}/build/lib*]
This won't work if the port is in a clean state at the time the portfile is parsed because ${worksrcpath} and its contents don't exist yet.
For example: sudo port clean py39-pyzstd && sudo port test py39-pyzstd
fails because PYTHONPATH
is empty:
:debug:test Environment:
:debug:test PYTHONPATH=''
:info:test test_zstd (unittest.loader._FailedTest) ... ERROR :info:test ====================================================================== :info:test ERROR: test_zstd (unittest.loader._FailedTest) :info:test ---------------------------------------------------------------------- :info:test ImportError: Failed to import test module: test_zstd :info:test Traceback (most recent call last): :info:test File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/unittest/loader.py", line 154, in loadTestsFromName :info:test module = __import__(module_name) :info:test File "/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-ryandesign-fork_python_py-pyzstd/py39-pyzstd/work/pyzstd-0.15.0/tests/test_zstd.py", line 20, in <module> :info:test import pyzstd :info:test ModuleNotFoundError: No module named 'pyzstd' :info:test ----------------------------------------------------------------------
A subsequent sudo port test py39-pyzstd
without cleaning first succeeds.
To avoid this problem, if you need to glob
or otherwise inspect the contents of ${worksrcpath}, you can't do it in the global part of the portfile. You have to defer it to a time when ${worksrcpath} exists. In this case, you should enclose at least the test.env
line in a pre-test
block.
Change History (1)
comment:1 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)
Description: | modified (diff) |
---|
Note: See
TracTickets for help on using
tickets.