ocean800 ocean800 - 1 year ago 529
Python Question

Pycharm - no tests were found?

I've been getting a

No tests were found

error in Pycharm and I can't figure out why I'm getting it... this is what I have for my

import unittest
import sys
import os

sys.path.insert(0, os.path.abspath('..'))

from ..point import Point

class TestPoint(unittest.TestCase):
def setUp(self):

def xyCheck(self,x,y):
point = Point(x,y)

and this
, what I'm trying to test:

import unittest

from .utils import check_coincident, shift_point

class Point(object):
def __init__(self,x,y,mark={}):
self.x = x
self.y = y
self.mark = mark

def patched_coincident(self,point2):
point1 = (self.x,self.y)
return check_coincident(point1,point2)

def patched_shift(self,x_shift,y_shift):
point = (self.x,self.y)
self.x,self,y = shift_point(point,x_shift,y_shift)

Is it something wrong with my run configuration? I looked at this SO post but I'm still utterly confused. My run configuration currently looks like this:

enter image description here

I guess I just understand what I could be doing wrong? Any help would be greatly appreciated, thanks!!

Answer Source

in order to recognize test functions they must be named test_ in your case rename xyCheck to test_xyCheck :)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download