How to execute specific tests from pycharm terminal? what is the command? - python

I have 5 python tests in pycharm editor. Now i Want to run 1st and 4th test specifically from pycharm terminal. What is the command we have to give to run the 1st and 4th tests?
I have 5 python tests in pycharm editor. Now i Want to run 1st and 4th test specifically from pycharm terminal. What is the command we have to give to run the 1st and 4th tests?

Related

I want to use python option -m when i use pycharm debugger

Hi I got the project on the github, I want to analyze this code using debugging.
The project uses python 3.6 and requires next command when running
python -m pixloc.run_Aachen
pixloc is package (directory) name and run_Aachen is python file name.
When I run this command using Pycharm, It is successful
but When I run this using Pycharm Debug mode, It is fail
the following image is my Run/Debug Configuration
enter image description here
What can I do for this problem
I try to use setuptools.setup(), but this isn't work
I just want to use -m option in debug
Your run configuration is currently set to to run a Python script (i.e., as python ./path/to/script.py), but you want to execute a module (i.e., python -m package.subpack.mod).
To change your run configuration to one that executes a module, do the following:
Under the run configuration, click on the first dropdown that reads "Script path" and change it to "Module name".
Then, specify pixloc.run_Aachen in accompanying testbox.

my code is not showing is the terminal and there is no error

I was trying to run a code in vs code but the code didn't run and there is no error showing in the terminal. I made a new file and then tried to run a "Hello World!" but the code didn't run too. I uninstalled and re-installed vs code (three times) but that didn't work.
And when I say that there is no error showing I mean it. whenever I run the code nothing happens and vs code doesn't even give a hint or a sign that the code got executed or not.
First, you should understand that vscode is a lightweight editing
tool. If you want to run python files, first make sure you have
installed python correctly. You can enter command python --version
in the terminal to confirm it.
Then, please install python extension in the vscode extension store.
Then use shortcuts "Ctrl+Shift+P" and type "Python: Select
Interpreter" to choose the python interpreter.
Finally, creat *.py file and run it.
Read this docs for more details which can help you get started faster.

I don't want all these lines printing everytime I run the python code in VS Code in zsh (Mac terminal)

This appears every time I run a code from VS using zsh
The same happens even when I run it through the integrated terminal. This does not happen when I run the code in pycharm. How to fix this, please help.
Looks like you are debugging your code. The outputs maybe have related to the launch.json file. Could you create a new configuration and selected it to have a test again?
Or could you just right-click and select Run Python File in Terminal.

How to run just one django test from file with VSCode?

I have some tests in tests.py and want to run just one of them with VSCode easily. Of course, I can do it via command line, but I think it is possible to configure VSCode to be able to do it via GUI.
See https://code.visualstudio.com/docs/python/unit-testing which shows two different ways to run individual tests (test explorer and test lenses).

PyCharm running Python file always opens a new console

I initially started learning Python in Spyder, but decided to switch to PyCharm recently, hence I'm learning PyCharm with a Spyder-like mentality.
I'm interested in running a file in the Python console, but every time I rerun this file, it will run under a newly opened Python console. This can become annoying after a while, as there will be multiple Python consoles open which basically all do the same thing but with slight variations.
I would prefer to just have one single Python console and run an entire file within that single console. Would anybody know how to change this? Perhaps the mindset I'm using isn't very PyCharmic?
There is a specific option in PyCharm 2018.2+: Settings | Build, Execution, Deployment | Console | Use existing console for "Run with Python console".
Run with Python console is an option you have enabled in the Run Configuration. Disable it if you don't need a Python console after a script execution:
Hi: If you are looking for re running the code again in the same python console everytime then you have to check the respective box in the Project settings as shown in image below.
To allow only one instance to run, go to "Run" in the top bar, then "Edit Configurations...". Finally, check "Single instance only" at the right side. This will run only one instance and restart every time you run.
One console is one instance of Python being run on your system. If you want to run different variations of code within the same Python kernel, you can highlight the code you want to run and then choose the run option (Alt+Shift+F10 default).
You have an option to Rerun the program.
Simply open and navigate to currently running app with:
Alt+4 (Windows)
⌘+4 (Mac)
And then rerun it with:
Ctrl+R (Windows)
⌘+R (Mac)
Another option:
Show actions popup:
Ctrl+Shift+A (Windows)
⇧+⌘+A (Mac)
And type Rerun ..., IDE then hint you with desired action, and call it.
I think that what you are looking for is the last option in this window; check it and it should work.
Settings -> Build, Execution, Deployment -> Console

Categories