JetBrains / intellij-micropython

Plugin for MicroPython devices in PyCharm and IntelliJ
https://plugins.jetbrains.com/plugin/9777-micropython
Apache License 2.0
495 stars 106 forks source link

Cannot have pytest and flash file to microcontroller run in context menu at same time #246

Open randomsmith9 opened 10 months ago

randomsmith9 commented 10 months ago

Raising here as per comment in https://intellij-support.jetbrains.com/hc/en-us/community/posts/13220957077522-How-to-change-default-runner-is-stuck-on-micropython-plugin

I have a python project in Intellij and have pytest and micropython plugins

After running some unit tests as normal, I then ran the micropython flash folder run configuration. (flash means copy files onto a microcontroller that is attached) Raising this here as per comment in https://intellij-support.jetbrains.com/hc/en-us/community/posts/13220957077522-How-to-change-default-runner-is-stuck-on-micropython-plugin Now when I click on the green triangle to run some test, it wants to flash them instead.

I have tried removing all the run configuration but the default option is to micropython flash.

But want to right click on a test and say run as pytest but that doesn't appear. When I right click on say test_xxx, I see "Run Flash 'test_xxx.py'" but not "Run pytest test_xxx.py"

what do I need to do to have pytest show as a runnable option?

EDIT 1: I was following a JetBrains post that said to edit the module of the project to ensure it was python

then add the micropython facet. On doing this, I could flash a microcontroller but lose the option to run unit tests.

If I remove the micropython facet from the project, I can run pytest unit tests again.

How do I get the ability to have both options appear in context menu?

IntelliJ IDEA 2023.2 (Community Edition) Build #IC-232.8660.185, built on July 26, 2023 Runtime version: 17.0.7+7-b1000.6 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Windows 11.0 GC: G1 Young Generation, G1 Old Generation Memory: 2048M Cores: 20 Registry: debugger.new.tool.window.layout=true ide.experimental.ui=true

Non-Bundled Plugins: com.jetbrains.packagesearch.intellij-plugin (232.8660.142) PythonCore (232.8660.185) intellij-micropython (1.4.1-2023.2)

Kotlin: 232-1.9.0-IJ8660.185