class MyTestCase(TestCase):

    def test_a(self):
        with open('testcase.txt') as ifile:
            for iline in ifile:
                with self.subTest(line=iline):
                    pass
Для цикла в unittest