Commits

David Burns committed bdab43e

renaming items from keyword to mark as per code review

Comments (0)

Files changed (1)

_pytest/markification.py

     group._addoption('-m',
         action="append", dest="filter", default=[], metavar="FILTEREXPR",
         help="only run tests which have marks that match given"
-             "keyword expression.  "
+             "mark expression.  "
              "An expression consists of space-separated terms. "
              "Each term must match. Precede a term with '-' to negate.")
 
         dirty_items = copy.copy(items)
         
         for item in dirty_items:
-            if filtr[:1] != '-' and skipbykeyword(item, filtr):
+            if filtr[:1] != '-' and skipbymark(item, filtr):
                 # skip
                 deselected.append(item)
-            elif filtr[:1] == '-' and skipbykeyword(item, filtr):
+            elif filtr[:1] == '-' and skipbymark(item, filtr):
                 # remove
                 deselected.append(item)
                 if item in remaining:
         items[:] = remaining
 
 # blatantly lifted from _pytest.mark.py
-def skipbykeyword(colitem, keywordexpr):
-    """ return True if they given keyword expression means to
+def skipbymark(colitem, markexpr):
+    """ return True if they given mark expression means to
         skip this collector/item.
     """
-    if not keywordexpr:
+    if not markexpr:
         return
 
-    itemkeywords = getkeywords(colitem)
-    for key in filter(None, keywordexpr.split()):
+    itemkeywords = getmarks(colitem)
+    for key in filter(None, markexpr.split()):
         eor = key[:1] == '-'
         if eor:
             key = key[1:]
-        if not (eor ^ matchonekeyword(key, itemkeywords)):
+        if not (eor ^ matchonemark(key, itemkeywords)):
             return True
 
 # blatantly lifted from _pytest.mark.py but checks not for whether it is a MarkInfo object
-def getkeywords(node):
-    keywords = {}
+def getmarks(node):
+    marks = {}
     while node is not None:
         for keyword in node.keywords:
             if isinstance(node.keywords[keyword], MarkInfo):
-                keywords[keyword] = node.keywords[keyword]
+                marks[keyword] = node.keywords[keyword]
         node = node.parent
-    return keywords
+    return marks 
 
 # blatantly lifted from _pytest.mark.py
-def matchonekeyword(key, itemkeywords):
-    for elem in key.split("."):
-        for kw in itemkeywords:
+def matchonemark(mark, itemmarkwords):
+    for elem in mark.split("."):
+        for kw in itemmarkwords:
             if elem in kw:
                 break
         else: