From 6cdf70823b344b99d6623af19fb618a9c2dbdad4 Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Thu, 6 Jun 2019 23:27:02 -0400 Subject: Refactored how and when transcript file glob patterns are expanded in order to present a better error message to user --- cmd2/transcript.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'cmd2/transcript.py') diff --git a/cmd2/transcript.py b/cmd2/transcript.py index b5cb5397..b507cbf2 100644 --- a/cmd2/transcript.py +++ b/cmd2/transcript.py @@ -10,7 +10,6 @@ This file contains the classess necessary to make that work. These classes are used in cmd2.py::run_transcript_tests() """ import re -import glob import unittest from typing import Tuple @@ -30,13 +29,10 @@ class Cmd2TestCase(unittest.TestCase): def fetchTranscripts(self): self.transcripts = {} - for fileset in self.cmdapp.testfiles: - for fname in glob.glob(fileset): - tfile = open(fname) - self.transcripts[fname] = iter(tfile.readlines()) - tfile.close() - if not len(self.transcripts): - raise Exception("No test files found - nothing to test.") + for fname in self.cmdapp.testfiles: + tfile = open(fname) + self.transcripts[fname] = iter(tfile.readlines()) + tfile.close() def setUp(self): if self.cmdapp: -- cgit v1.2.1