Open ikappaki opened 1 week ago
This issue is specific to MS-Windows and works fine on Linux.
It only occurs when pytest
is invoked programmatically.
Here are a couple of workarounds
pytest
not to capture output
> basilisp test -- -s
==================================================== test session starts ====================================================
platform win32 -- Python 3.11.4, pytest-8.3.3, pluggy-1.5.0
configfile: pyproject.toml
plugins: basilisp-0.2.4
collecting ... :calc 8
collected 1 item
tests\issuetests\issue_test.lpy .
===================================================== 1 passed in 0.03s =====================================================
2. Run `pytest` directly, ensure the empty dir is added to the `PYTHONPATH` so it can pick up the local directory. For example on PowerShell:
``` powershell
> $env:PYTHONPATH="."
> pytest
==================================================== test session starts ====================================================
platform win32 -- Python 3.11.4, pytest-8.3.3, pluggy-1.5.0
configfile: pyproject.toml
plugins: basilisp-0.2.4
collecting ... :calc 8
collected 1 item
tests\issuetests\issue_test.lpy . [100%]
===================================================== 1 passed in 0.02s =====================================================
I'll have a look. Thanks
Hi,
when running
basilisp test
, an error occurs when trying toprint
from a test fileTo reproduce,
basilisp
, you should see the error==================================================== test session starts ==================================================== platform win32 -- Python 3.11.4, pytest-8.3.3, pluggy-1.5.0 rootdir: D:\bas\issue-bas-test-macro-print configfile: pyproject.toml plugins: basilisp-0.2.4 collected 0 items / 1 error
========================================================== ERRORS =========================================================== _ ERROR collecting tests/issuetests/issue_test.lpy __ ... During handling of the above exception, another exception occurred: tests\issuetests\issue_test.lpy:4: in
(println :calc (+ 5 3))
..\issuetests.venv\Lib\site-packages\basilisp\core.lpy:4376: in println
(defn println
..\issuetests.venv\Lib\site-packages\basilisp\core.lpy:4398: in printlnarity_rest
(.write stdout os/linesep)
E OSError: [WinError 6] The handle is invalid
===================================================== warnings summary ======================================================
..\issuetests.venv\Lib\site-packages_pytest\config__init__.py:1277
d:\bas\issuetests.venv\Lib\site-packages_pytest\config\init__.py:1277: PytestAssertRewriteWarning: Module already imported so cannot be rewritten: basilisp
self._mark_plugins_for_rewrite(hook)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ================================================== short test summary info ================================================== ERROR tests/issuetests/issue_test.lpy - OSError: [WinError 6] The handle is invalid !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ================================================ 1 warning, 1 error in 0.11s ================================================ :calc 8
Commenting out the
println
form allows the test to run without error.This could as well be a MS-Windows only issue, I haven't had the chance to test on another architecture yet.
Thanks