diff options
author | Matěj Cepl <mcepl@redhat.com> | 2014-06-23 15:53:29 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2014-06-23 15:54:51 +0200 |
commit | c53b2bf00cbaf5f4cedb5ac00948447d7f7e290b (patch) | |
tree | e7f1273e05d54bb849cf7aab8464cf87d3fe8fe4 | |
parent | 5cde8f20dc328706651db6be8502dcb0f910e221 (diff) | |
download | cucutags-c53b2bf00cbaf5f4cedb5ac00948447d7f7e290b.tar.gz |
Remove 'given|step|when|then' from the feature for which we seek target.
-rwxr-xr-x | cucutags.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/cucutags.py b/cucutags.py index a463258..9d96af1 100755 --- a/cucutags.py +++ b/cucutags.py @@ -31,7 +31,7 @@ logging.basicConfig(format='%(levelname)s:%(funcName)s:%(message)s', import parse __docformat__ = 'reStructuredText' -__version__ = "0.7.0" +__version__ = "0.7.1" __author__ = u"Matěj Cepl <mcepl_at_redhat_dot_com>" @@ -40,6 +40,7 @@ class Target(object): Represents one line from the Python modules. """ pattern = re.compile(r"^\s*@(step|when|given|then)\(u?'(.*)'\)") + cleanRE = re.compile('^(step|when|given|then)\s*', re.IGNORECASE) result = 'targets' def __init__(self, text, filename, lineno): @@ -59,7 +60,7 @@ class Target(object): Checks whether the target line can be expanded to match the Feature. """ - out = self.parser.parse(feature) + out = self.parser.parse(self.cleanRE.sub('', feature)) if out: logging.debug("out = %s", out) return out @@ -129,12 +130,8 @@ class CodeFile(io.TextIOWrapper): lineno = 0 for line in f.readlines(): lineno += 1 - logging.debug('line = %s', line) - logging.debug('pattern = %s', ftype.pattern.pattern) matches = ftype.pattern.search(line) if matches: - logging.debug("key = %s", ftype.result) - logging.debug("value = %s", matches.group(2)) obj = ftype(matches.group(2), self.name, lineno) out[ftype.result].append(obj) @@ -178,9 +175,8 @@ class Session(object): return out def get_step(self, feature): - logging.debug("feature = %s", feature) - logging.debug("self.target_list = %s", self.target_list) for trg in self.target_list: + logging.debug("feature = %s", feature) logging.debug("trg = %s", trg) if trg.ismatch(feature): return trg.filename, trg.lineno |