Pycharm - no tests were found?

2019-04-19 10:41发布

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 point_test.py:

import unittest
import sys
import os

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

from ..point import Point


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

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

and this point.py, 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!!

7条回答
时光不老,我们不散
2楼-- · 2019-04-19 11:40

Another issue you may want to check is if you see in the console output "## tests deselected by '-k XXXX'". This means you've added a Keyword to the Run/Debug Configuration, and Pycharm will only run tests whose name contains the keyword.

查看更多
登录 后发表回答