[Pytest-commit] commit/pytest: hpk42: remove unused cache argument for re-ordering items.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Sat Dec 7 21:00:40 CET 2013


1 new commit in pytest:

https://bitbucket.org/hpk42/pytest/commits/fb2e642e27d1/
Changeset:   fb2e642e27d1
User:        hpk42
Date:        2013-12-07 21:00:33
Summary:     remove unused cache argument for re-ordering items.
Affected #:  1 file

diff -r 2d60500846988334a64c2abe6f80ac44a0ea0085 -r fb2e642e27d18b1aadfda9500742711f0feb6001 _pytest/python.py
--- a/_pytest/python.py
+++ b/_pytest/python.py
@@ -1626,7 +1626,7 @@
 
     def pytest_collection_modifyitems(self, items):
         # separate parametrized setups
-        items[:] = reorder_items(items, set(), {}, 0)
+        items[:] = reorder_items(items, set(), 0)
 
     def parsefactories(self, node_or_obj, nodeid=NOTSET, unittest=False):
         if nodeid is not NOTSET:
@@ -1825,14 +1825,14 @@
 # down to the lower scopes such as to minimize number of "high scope"
 # setups and teardowns
 
-def reorder_items(items, ignore, cache, scopenum):
+def reorder_items(items, ignore, scopenum):
     if scopenum >= scopenum_function or len(items) < 3:
         return items
     items_done = []
     while 1:
         items_before, items_same, items_other, newignore = \
-                slice_items(items, ignore, cache, scopenum)
-        items_before = reorder_items(items_before, ignore, cache, scopenum+1)
+                slice_items(items, ignore, scopenum)
+        items_before = reorder_items(items_before, ignore, scopenum+1)
         if items_same is None:
             # nothing to reorder in this scope
             assert items_other is None
@@ -1842,13 +1842,13 @@
         ignore = newignore
 
 
-def slice_items(items, ignore, cache, scopenum):
+def slice_items(items, ignore, scopenum):
     # we pick the first item which uses a fixture instance in the requested scope
     # and which we haven't seen yet.  We slice the input items list into
     # a list of items_nomatch, items_same and items_other
     slicing_argkey = None
     for i, item in enumerate(items):
-        argkeys = get_parametrized_fixture_keys(item, ignore, scopenum, cache)
+        argkeys = get_parametrized_fixture_keys(item, ignore, scopenum)
         if slicing_argkey is None:
             if argkeys:
                 slicing_argkey = argkeys.pop()
@@ -1866,7 +1866,7 @@
     newignore.add(slicing_argkey)
     return (items_before, items_same, items_other, newignore)
 
-def get_parametrized_fixture_keys(item, ignore, scopenum, cache):
+def get_parametrized_fixture_keys(item, ignore, scopenum):
     """ return list of keys for all parametrized arguments which match
     the specified scope. """
     assert scopenum < scopenum_function  # function
@@ -1886,13 +1886,6 @@
         elif scopenum == 1:  # module
             key = (argname, param_index, item.fspath)
         elif scopenum == 2:  # class
-            # enumerate classes per fspath
-            l = cache.setdefault(item.fspath, [])
-            try:
-                numclass = l.index(item.cls)
-            except ValueError:
-                numclass = len(l)
-                l.append(item.cls)
             key = (argname, param_index, item.fspath, item.cls)
         if key not in ignore:
             keys.add(key)

Repository URL: https://bitbucket.org/hpk42/pytest/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.


More information about the pytest-commit mailing list