How can I prevent PyCharm run pytest? Follow
Sometimes PyCharm run pytest on my application which I don't want. For example, I have two methods:
def train():
...
@torch.no_grad()
def test(model, x, y):
Then In my main function, even if I only. want to run 'train', PyCharm still run pytest for unit tests.
if __name__ == '__main__':
train()
The message is below:
/Users/min/nlp/kg/myenv/bin/python /Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm/_jb_pytest_runner.py --path /Users/min/nlp/kg/kg/embedding/experiments/ogb_node_classification.py
Testing started at 12:49 PM ...
Launching pytest with arguments /Users/min/nlp/kg/kg/embedding/experiments/ogb_node_classification.py --no-header --no-summary -q in /Users/min/nlp/kg/kg/embedding/experiments
============================= test session starts ==============================
The test with @torch.no_grad() is not for unit test, just a regular function like 'train'. How to prevent PyCharm from running as pytest always when I only want to run the function 'train'?
Please sign in to leave a comment.
Hi, could you please show a screenshot of the run/debug configuration that results it running the test?