I developed a crawler and it's unit-tests (mainly to validate XPATHs). I want to run specific unit-tests before script execution in order to be sure that HTML structure has not changed and existing XPATHs still working. I don't want the output of unit-test, just a flag: passed or failed.
for example:
tests.py:
import unittest
class CrwTst(unittest.TestCase):
def test_1(self):
[..]
crawler.py
class Crawler(object):
def action_1(self):
[..]
and I want to work like:
if CrwTst.test_1() is True:
Crawler.action_1()
test_my_thing(); action1()
. Also ZdaR is right, this seems an odd use of unit tests (which are intended to test your code itself, not to validate data you pass to your code).True
orFalse
from tests import CrwTst
and I'm getting import errorImportError: cannot import name CrwTst