Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#64045 closed defect (fixed)

py-distorm py-gobject py-jellyfish py-ngl py-numeric py-plumed py-pyrfc3339 py-pyrsistent py-pyzstd py-xlsx2csv: tests fail from clean state because glob is used in global part of portfile

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: catap (Kirill A. Korinsky)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: GiovanniBussi (Giovanni), jmroot (Joshua Root), kurthindenburg (Kurt Hindenburg), petrrr, stromnov (Andrey Stromnov)
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 (13)

comment:1 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)

comment:2 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: GiovanniBussi jmroot kurthindenburg petrrr stromnov added
Port: py-distorm py-gobject py-jellyfish py-ngl py-numeric py-plumed py-pyrfc3339 py-pyrsistent py-xlsx2csv added
Summary: py-pyzstd: tests fail from clean state because glob is used in global part of portfilepy-distorm py-gobject py-jellyfish py-ngl py-numeric py-plumed py-pyrfc3339 py-pyrsistent py-pyzstd py-xlsx2csv: tests fail from clean state because glob is used in global part of portfile

This problem affects several python modules. Might as well fix them all at once.

comment:3 Changed 3 years ago by catap (Kirill A. Korinsky)

@ryandesign, let me fix it globally

comment:4 Changed 3 years ago by catap (Kirill A. Korinsky)

Resolution: fixed
Status: assignedclosed

In a4825970af92f07f1f32af81129a8f09fe5997ad/macports-ports (master):

py-distorm: fixed tests

Closes #64045

comment:5 Changed 3 years ago by catap (Kirill A. Korinsky)

In f39d34f276213f4c8f5370e57a600406213d51cd/macports-ports (master):

py-gobject: fixed tests

Closes #64045

comment:6 Changed 3 years ago by catap (Kirill A. Korinsky)

In e15145928f9e78c042e6d806792a9b9fa91365cc/macports-ports (master):

py-jellyfish: fixed tests

Closes #64045

comment:7 Changed 3 years ago by catap (Kirill A. Korinsky)

In e7031acc989d00e3947766148824b9968b6af055/macports-ports (master):

py-ngl: fixed tests

Closes #64045

comment:8 Changed 3 years ago by catap (Kirill A. Korinsky)

In ee5b0561134609b2b9a3b3d0d47054ffaa9e0d85/macports-ports (master):

py-numeric: fixed tests

Closes #64045

comment:9 Changed 3 years ago by catap (Kirill A. Korinsky)

In 857f5e28b54751fbd8544efec0e45352669390ab/macports-ports (master):

py-plumed: fixed tests

Closes #64045

comment:10 Changed 3 years ago by catap (Kirill A. Korinsky)

In 0a28141f9c55302ad28b40a483197134df274e7a/macports-ports (master):

py-pyrfc3339: fixed tests

Closes #64045

comment:11 Changed 3 years ago by catap (Kirill A. Korinsky)

In 9770668577fe18658db16276732c03920607a2bd/macports-ports (master):

py-pyrsistent: fixed tests

Closes #64045

comment:12 Changed 3 years ago by catap (Kirill A. Korinsky)

In 15d22905c7061c551fc03932857a91708f7950e9/macports-ports (master):

py-pyzstd: fixed tests

Closes #64045

comment:13 Changed 3 years ago by catap (Kirill A. Korinsky)

In af3cb47b613ced6d800b5f534c28c60ac7392d9f/macports-ports (master):

py-xlsx2csv: fixed tests

Closes #64045

Note: See TracTickets for help on using tickets.