Skip to content

Failed test generation for python projects with special named files #2008

Closed
@tamarinvs19

Description

@tamarinvs19

Description

Test generation failed when project contains file which has name same as builtins module: e.g. abc.py, types.py, typing.py.

To Reproduce

Steps to reproduce the behavior:

  1. Open project with file named same as builtins module. For example, projects pydantic, fastapi, flask.
  2. Try to generate tests

Expected behavior

Tests are supposed to be generated.

Actual behavior

Exception about mypy problems.

on Windows

ValueError: path is on mount '\\\\localhost\\C$', start on mount 'C:'
Mypy stderr: null
java.lang.IllegalStateException: Something went wrong in initial mypy run. 
Python stderr Traceback (most recent call last):
  File "C:\Users\tWX1238545\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\tWX1238545\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\tWX1238545\IdeaProjects\pydantic\venv\lib\site-packages\utbot_mypy_runner\__main__.py", line 29, in 
    stdout, stderr, exit_status, build_result = mypy_main.run(mypy_args)
  File "C:\Users\tWX1238545\IdeaProjects\pydantic\venv\lib\site-packages\utbot_mypy_runner\mypy_main.py", line 128, in run
    return _run(lambda stdout, stderr: new_main(args=args, stdout=stdout, stderr=stderr, clean_exit=True))
  File "C:\Users\tWX1238545\IdeaProjects\pydantic\venv\lib\site-packages\utbot_mypy_runner\mypy_main.py", line 118, in _run
    res = main_wrapper(stdout, stderr)
  File "C:\Users\tWX1238545\IdeaProjects\pydantic\venv\lib\site-packages\utbot_mypy_runner\mypy_main.py", line 128, in 
    return _run(lambda stdout, stderr: new_main(args=args, stdout=stdout, stderr=stderr, clean_exit=True))
  File "C:\Users\tWX1238545\IdeaProjects\pydantic\venv\lib\site-packages\utbot_mypy_runner\mypy_main.py", line 63, in new_main
    res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
  File "mypy\main.py", line 174, in run_build
  File "mypy\build.py", line 194, in build
  File "mypy\build.py", line 257, in _build
  File "mypy\build.py", line 686, in __init__
  File "C:\Users\tWX1238545\AppData\Local\Programs\Python\Python39\lib\ntpath.py", line 703, in relpath
    raise ValueError("path is on mount %r, start on mount %r" % (
ValueError: path is on mount '\\\\localhost\\C$', start on mount 'C:'

on Linux

Python stderr 
Mypy stderr: mypy: "../../../../../../../../../Projects/ut/pydantic/pydantic/types.py" shadows library module "types"
note: A user-defined top-level module with name "types" is not supported
at org.utbot.python.newtyping.mypy.RunMypyKt.readMypyAnnotationStorageAndInitialErrors(RunMypy.kt:52)
at org.utbot.python.PythonTestGenerationProcessor.processTestGeneration(PythonTestGenerationProcessor.kt:83)
at org.utbot.python.PythonTestGenerationProcessor.processTestGeneration$default(PythonTestGenerationProcessor.kt:38)
at org.utbot.intellij.plugin.language.python.PythonDialogProcessor$createTests$1.run(PythonDialogProcessor.kt:174)
at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:429)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$6(CoreProgressManager.java:480)
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:186)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:604)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:679)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:635)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:603)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:173)
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)

Environment

Linux and Windows

Metadata

Metadata

Assignees

Labels

ctg-bugIssue is a buglang-pythonIssue is related to python support

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions