Closed
Description
Hi,
when running basilisp test
, an error occurs when trying to print
from a test file
(.write stdout os/linesep)
E OSError: [WinError 6] The handle is invalid
To reproduce,
- Clone https://github.com/ikappaki/issue-bas-test-macro-print example project, and setup
git clone https://github.com/ikappaki/issue-bas-test-macro-print
cd issue-bas-test-macro-print
poetry install
poetry shell
- Run the tests with
basilisp
, you should see the error
basilisp test
==================================================== 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 <module>
(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 println__arity_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
The test file just tries to printout a value (I've also added a test event though is irrelevant)
(ns tests.issuetests.issue-test
(:require [basilisp.test :refer [deftest are is testing]]))
(println :calc (+ 5 3))
(deftest 5-test []
(is (= 5 5)))
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