PTVS icon indicating copy to clipboard operation
PTVS copied to clipboard

Since the last update unittest is not working any longer

Open vsfeedback opened this issue 2 years ago • 2 comments

This issue has been moved from a ticket on Developer Community.


[regression] [worked-in:17.2] In "C:\Users\Flori\source\repos\FloPei\Research Task\test_1.py" ist kein Test verfügbar. Stellen Sie sicher, dass die Testdiscoverer und -executors registriert und die Versionseinstellungen für Plattform und Framework richtig sind, und wiederholen Sie den Vorgang. ========== Testermittlung abgeschlossen: 0 Tests in "2,3 Sek." gefunden ========== ========== Testermittlung wird gestartet ========== Für Research Task "Projekt" wird die Ermittlung "unittest" gestartet. Dieser Vorgang kann bis zu 60 Sekunden dauern. cd C:\Users\Flori\source\repos\FloPei\Research Task
set PYTHONPATH=C:\Users\Flori\source\repos\FloPei\Research Task
C:\Users\Flori\anaconda3\python.exe C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\EXTENSIONS\MICROSOFT\PYTHON\CORE\PythonFiles\testing_tools\run_adapter.py discover unittest --output-file C:\Users\Flori\AppData\Local\Temp\tmp1B95.tmp -- . test*.py Failed to import test module: test_1 Traceback (most recent call last): File "C:\Users\Flori\anaconda3\lib\unittest\loader.py", line 436, in _find_test_path module = self._get_module_from_name(name) File "C:\Users\Flori\anaconda3\lib\unittest\loader.py", line 377, in _get_module_from_name import(name) File "C:\Users\Flori\source\repos\FloPei\Research Task\test_1.py", line 2, in from Research_Task import list3_sumdev ImportError: cannot import name 'list3_sumdev' from 'Research_Task' (C:\Users\Flori\source\repos\FloPei\Research Task\Research_Task.py)

In "C:\Users\Flori\source\repos\FloPei\Research Task\test_1.py" ist kein Test verfügbar. Stellen Sie sicher, dass die Testdiscoverer und -executors registriert und die Versionseinstellungen für Plattform und Framework richtig sind, und wiederholen Sie den Vorgang. ========== Testermittlung abgeschlossen: 0 Tests in "2,3 Sek." gefunden ========== Keine Tests zum Ausführen gefunden. Keine Tests zum Ausführen gefunden. Keine Tests zum Ausführen gefunden.


Original Comments

Feedback Bot on 8/29/2022, 10:49 PM:

(private comment, text removed)


Original Solutions

(no solutions)

vsfeedback avatar Sep 07 '22 16:09 vsfeedback

Translation: no test is available in “C:\Users\Flori\source\repos\FloPei\Research Task\test_1.py”. Make sure the test discoverers and executors are registered and the platform and framework version settings are correct and retry the operation. ========== Test discovery completed: 0 tests in “2.3 sec.” found ========== ========== Starting test discovery ========== For Research Task “Project” the determination “unittest” is started. This process can take up to 60 seconds. cd C:\Users\Flori\source\repos\FloPei\Research Task set PYTHONPATH=C:\Users\Flori\source\repos\FloPei\Research Task C:\Users\Flori\anaconda3\python.exe C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\EXTENSIONS\MICROSOFT\PYTHON\CORE\PythonFiles\testing_tools\run_adapter.py discover unittest --output -file C:\Users\Flori\AppData\Local\Temp\tmp1B95.tmp – . test*.py Failed to import test module: test_1 Traceback (most recent call last): File “C:\Users\Flori\anaconda3\lib\unittest\loader.py”, line 436, in _find_test_path module = self._get_module_from_name(name) File “C:\Users\Flori\anaconda3\lib\unittest\loader.py”, line 377, in _get_module_from_name import(name) File “C:\Users\Flori\source\repos\FloPei\Research Task\test_1.py”, line 2, in from Research_Task import list3_sumdev ImportError: cannot import name 'list3_sumdev' from 'Research_Task' (C:\Users\Flori\source\repos\FloPei\Research Task\Research_Task.py)

No test is available in “C:\Users\Flori\source\repos\FloPei\Research Task\test_1.py”. Make sure the test discoverers and executors are registered and the platform and framework version settings are correct and retry the operation. ========== Test discovery completed: 0 tests in “2.3 sec.” found ========== No tests found to run. No tests found to run. No tests found to run.

StellaHuang95 avatar Sep 07 '22 17:09 StellaHuang95

Hi there, this looks like an importing issue. Can you check if the list3_sumdev is not available/misspelled/misplaced? Or do you have circular imports?

It would also be helpful if you could share your folder structure, files and repro steps. Thanks! 😊

StellaHuang95 avatar Sep 07 '22 23:09 StellaHuang95

Going to close this out. If the issue still persists, please reopen with the information requested. Thanks.😊

StellaHuang95 avatar Oct 10 '22 21:10 StellaHuang95