
Hi! I'm trying to run the self tests for the pkgsrc package for lxml, currently at 5.3.0. lxml itself seems to work fine AFAICT, but I can't get the self tests to runs. I tried following the documented method from https://lxml.de/build.html but I get: ``` # python3.12 test.py Traceback (most recent call last): File "/scratch/textproc/py-lxml/work/lxml-5.3.0/test.py", line 620, in <module> exitcode = main(sys.argv) ^^^^^^^^^^^^^^ File "/scratch/textproc/py-lxml/work/lxml-5.3.0/test.py", line 557, in main test_cases = get_test_cases(test_files, cfg, cov=cov) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/scratch/textproc/py-lxml/work/lxml-5.3.0/test.py", line 260, in get_test_cases module = import_module(file, cfg, cov=cov) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/scratch/textproc/py-lxml/work/lxml-5.3.0/test.py", line 201, in import_module mod = __import__(modname) ^^^^^^^^^^^^^^^^^^^ File "/scratch/textproc/py-lxml/work/lxml-5.3.0/src/lxml/html/__init__.py", line 49, in <module> from .. import etree ImportError: cannot import name 'etree' from 'lxml' (/scratch/textproc/py-lxml/work/lxml-5.3.0/src/lxml/__init__.py) ``` so I guessed the PYTHONPATH was not set correctly and tried that: ``` # PYTHONPATH=build/lib.netbsd-10.99.11-amd64-cpython-312/ python3.12 test.py ``` with the same result. I can import lxml.etree this way: ``` # PYTHONPATH=build/lib.netbsd-10.99.11-amd64-cpython-312/lxml/etree.so python3.12 -c "import lxml.etree" Traceback (most recent call last): File "<string>", line 1, in <module> ModuleNotFoundError: No module named 'lxml' # PYTHONPATH=build/lib.netbsd-10.99.11-amd64-cpython-312 python3.12 -c "import lxml.etree" # ``` so I guess the test script doesn't honor it. How can I run the tests? Thanks, Thomas

Hi, I believe the tests can only be run from an in-place build. Because pkgsrc builds to a build/ directory outside the src/ directory, it is not in-place. To build in-place, use python setup.py build_ext -i --with-cython. You may also have to use --static-deps or --with-xml2-config=<path to config> and --with-xslt-config=<path to config>. Best, Abe Polk
participants (2)
-
abepolk@gmail.com
-
wiz@gatalith.at