Skip to content

UTbot Python cannot generate test when project located at path with russian letters #1815

Closed

Description

@tyuldashev

Description

MyPy cannot find project module when path contains russian letters.

To Reproduce

Steps to reproduce the behavior:

  1. Put your Python project in folder with name Питон
  2. Open the project
  3. Invoke test generation for a python file.

Expected behavior

Tests are supposed to be generated.

Actual behavior

Tests are not generated, exception thrown.

Visual proofs (screenshots, logs, images)

Example:

java.lang.IllegalStateException: Something went wrong in initial mypy run. 
Python stderr 
Mypy stderr: mypy: can't find module 'src.main'

	at org.utbot.python.newtyping.mypy.RunMypyKt.readMypyAnnotationStorageAndInitialErrors(RunMypy.kt:50)
	at org.utbot.python.PythonTestGenerationProcessor.processTestGeneration(PythonTestGenerationProcessor.kt:82)
	at org.utbot.python.PythonTestGenerationProcessor.processTestGeneration$default(PythonTestGenerationProcessor.kt:32)
	at org.utbot.intellij.plugin.language.python.PythonDialogProcessor$createTests$1.run(PythonDialogProcessor.kt:171)
	at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:442)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$5(CoreProgressManager.java:493)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:252)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:188)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:175)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:252)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
	at java.base/java.lang.Thread.run(Thread.java:833)

Activity

  1. tyuldashev commented on Mar 6, 2023

    @tyuldashev
    CollaboratorAuthor

    Tests are generated but IDEA itself cannot run such tests:

    C:\Python311\python.exe C:/Users/t00814305/AppData/Roaming/JetBrains/IntelliJIdea2022.2/plugins/python/helpers/pycharm/_jb_pytest_runner.py --target test_calc_my_calc.py::TestTopLevelFunctions 
    Testing started at 15:50 ...
    Traceback (most recent call last):
      File "C:\Users\t00814305\AppData\Roaming\JetBrains\IntelliJIdea2022.2\plugins\python\helpers\pycharm\_jb_pytest_runner.py", line 40, in <module>
        jb_doc_args("pytest", args)
      File "C:\Users\t00814305\AppData\Roaming\JetBrains\IntelliJIdea2022.2\plugins\python\helpers\pycharm\_jb_runner_tools.py", line 320, in jb_doc_args
        print("Launching {0} with arguments {1} in {2}\n".format(framework_name, " ".join(args), PROJECT_DIR))
      File "C:\Python311\Lib\encodings\cp1252.py", line 19, in encode
        return codecs.charmap_encode(input,self.errors,encoding_table)[0]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    UnicodeEncodeError: 'charmap' codec can't encode characters in position 146-150: character maps to <undefined>
    
    Process finished with exit code 1
    
    Empty suite
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

comp-codegenIssue is related to code generatorctg-bugIssue is a buglang-pythonIssue is related to python support

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions