krzema12 / kotlin-python

Python target for the Kotlin Programming Language. See https://github.com/krzema12/kotlin-python/tree/python-backend/python
https://discuss.kotlinlang.org/t/idea-python-backend/19852
47 stars 1 forks source link

Run MicroPython e2e tests #85

Open krzema12 opened 2 years ago

krzema12 commented 2 years ago

With no changes, I get this:

Traceback (most recent call last):
  File "python/e2e-tests/out/python-consumer.py", line 5, in <module>
OSError: [Errno 13] EACCES

When not writing to file, only one test fails, and the rest produces something that is expected:

$ JDK_9="$JAVA_HOME" python/e2e-tests/run.sh
Starting end-to-end tests
===== Executing 'constructors' =====
  Compiling to Python...
python/e2e-tests/out/kotlin-code.kt:3:26: warning: parameter 'a' is never used
class MultiConstructors1(a: Int) {
                         ^
python/e2e-tests/out/kotlin-code.kt:9:17: warning: parameter 'b' is never used
    constructor(b: String) : this(2) {
                ^
python/e2e-tests/out/kotlin-code.kt:24:17: warning: parameter 'a' is never used
    constructor(a: Int) {
                ^
python/e2e-tests/out/kotlin-code.kt:28:17: warning: parameter 'b' is never used
    constructor(b: String) {
                ^
python/e2e-tests/out/kotlin-code.kt:43:17: warning: parameter 'a' is never used
    constructor(a: Int) {
                ^
python/e2e-tests/out/kotlin-code.kt:47:17: warning: parameter 'b' is never used
    constructor(b: String) : this(3) {
                ^
python/e2e-tests/out/kotlin-code.kt:51:17: warning: parameter 'b' is never used
    constructor(b: Boolean) : this("c") {
                ^
python/e2e-tests/out/kotlin-code.kt:70:17: warning: parameter 'i' is never used
    constructor(i: Int) {
                ^
python/e2e-tests/out/kotlin-code.kt:77:17: warning: parameter 'a' is never used
    constructor(a: Int) : super(4) {
                ^
  Running Python to produce the output...
body 11
Traceback (most recent call last):
  File "python/e2e-tests/out/python-consumer.py", line 6, in <module>
  File "/home/piotr/repos/priv/kotlin-python/python/e2e-tests/out/compiled.py", line 13692, in multi12
  File "/home/piotr/repos/priv/kotlin-python/python/e2e-tests/out/compiled.py", line 13670, in MultiConstructors1_init__Create_
AttributeError: type object 'MultiConstructors1' has no attribute '__new__'
===== Finished with 'constructors' =====
===== Executing 'integers' =====
  Compiling to Python...
  Running Python to produce the output...
True
False
120
4
-11
===== Finished with 'integers' =====
===== Executing 'lambdas' =====
  Compiling to Python...
  Running Python to produce the output...
40
20
21
143
===== Finished with 'lambdas' =====
===== Executing '_simple' =====
  Compiling to Python...
  Running Python to produce the output...
4
===== Finished with '_simple' =====
===== Executing 'stdlib' =====
  Compiling to Python...
  Running Python to produce the output...
123
===== Finished with 'stdlib' =====
All done
krzema12 commented 2 years ago
-    python3 python/e2e-tests/out/python-consumer.py > python/e2e-tests/out/output.txt
+    micropython python/e2e-tests/out/python-consumer.py | tee python/e2e-tests/out/output.txt

Using tee seems to solve the OSError: [Errno 13] EACCES issue.