How can I prevent PyCharm run pytest?

Sometimes PyCharm run pytest on my application which I don't want. For example, I have two methods:


def train():


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__':

The message is below:

/Users/min/nlp/kg/myenv/bin/python /Applications/ --path /Users/min/nlp/kg/kg/embedding/experiments/
Testing started at 12:49 PM ...
Launching pytest with arguments /Users/min/nlp/kg/kg/embedding/experiments/ --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'?  

1 comment
Comment actions Permalink

Hi, could you please show a screenshot of the run/debug configuration that results it running the test?


Please sign in to leave a comment.