pyswip icon indicating copy to clipboard operation
pyswip copied to clipboard

Tests break on current build

Open EricZinda opened this issue 4 years ago • 8 comments

I'm getting consistent failures on many tests in the current build. If I back out the changes from your last commit, they are fixed.

Here's an example from tests/test_foreign.py:

ERROR: atom_chars/2: Arguments are not sufficiently instantiated EE

ERROR: test_deterministic_foreign (main.MyTestCase)

Traceback (most recent call last): File "/Users/ericzinda/Enlistments/pyswip/tests/test_foreign.py", line 16, in test_deterministic_foreign prolog.assertz("father(michael,john)") File "/Users/ericzinda/Enlistments/pyswip/pyswip/prolog.py", line 140, in assertz next(cls.query(assertion.join(["assertz((", "))."]), catcherrors=catcherrors)) File "/Users/ericzinda/Enlistments/pyswip/pyswip/prolog.py", line 126, in call raise PrologError("".join(["Caused by: '", query, "'. ", pyswip.prolog.PrologError: Caused by: 'assertz((father(michael,john))).'. Returned: 'error(instantiation_error, context(:(system, /(atom_chars, 2)), Variable(72)))'.

====================================================================== ERROR: test_nondeterministic_foreign (main.MyTestCase)

Traceback (most recent call last): File "/Users/ericzinda/Enlistments/pyswip/tests/test_foreign.py", line 44, in test_nondeterministic_foreign result = list(prolog.query("nondet(X)")) File "/Users/ericzinda/Enlistments/pyswip/pyswip/prolog.py", line 126, in call raise PrologError("".join(["Caused by: '", query, "'. ", pyswip.prolog.PrologError: Caused by: 'nondet(X)'. Returned: 'error(instantiation_error, context(:(system, /($c_call_prolog, 0)), Variable(72)))'.


Ran 2 tests in 0.003s

FAILED (errors=2)

EricZinda avatar Apr 09 '20 20:04 EricZinda

@EricZinda Did you find a solution to this?

JeanChristopheRohner avatar Jun 21 '22 16:06 JeanChristopheRohner

Also reported here: https://swi-prolog.discourse.group/t/error-could-not-find-system-resources-when-trying-to-use-pyswip/5517/10

kamahen avatar Jun 21 '22 16:06 kamahen

No, sorry! That, plus some other issues I encountered caused me to want to try a different approach for swi prolog integration, described here: https://www.swi-prolog.org/pldoc/man?section=mqi-overview. This is now a part of the SWI Prolog distribution.

The python library that goes with it is here: https://pypi.org/project/swiplserver/

EricZinda avatar Jun 21 '22 16:06 EricZinda

Thanks for the tip!

JeanChristopheRohner avatar Jun 22 '22 08:06 JeanChristopheRohner

See Issue #143 -- it appears that the problem is due to an unexpected version of SWi-Prolog being used. pyswip can check for this using https://www.swi-prolog.org/pldoc/doc_for?object=c(%27PL_version_info%27)

kamahen avatar Jun 23 '22 20:06 kamahen

I ran into this problem (swipl 9.0.4) and the fix is to make a small change to core.py in the installed pyswipl. Details are here: https://swi-prolog.discourse.group/t/best-easiest-way-to-downgrade-to-version-8-4-3-on-linux-ubuntu-20-04/5966/9

It is odd that this small fix hasn't made it into the code yet.

adamcrussell avatar Feb 25 '24 06:02 adamcrussell