Use dict instead of OrderedDict on Python 3.7

OrderedDict is quite a bit heavier than just a dict.
This commit is contained in:
Ran Benita
2020-04-30 15:49:20 +03:00
parent 4787fd64a4
commit fcc473ab1c
4 changed files with 27 additions and 15 deletions
+3 -3
View File
@@ -6,7 +6,6 @@ ignores the external pytest-cache
"""
import json
import os
from collections import OrderedDict
from typing import Dict
from typing import Generator
from typing import List
@@ -23,6 +22,7 @@ from .pathlib import rm_rf
from .reports import CollectReport
from _pytest import nodes
from _pytest._io import TerminalWriter
from _pytest.compat import order_preserving_dict
from _pytest.config import Config
from _pytest.main import Session
from _pytest.python import Module
@@ -338,8 +338,8 @@ class NFPlugin:
self, session: Session, config: Config, items: List[nodes.Item]
) -> None:
if self.active:
new_items = OrderedDict() # type: OrderedDict[str, nodes.Item]
other_items = OrderedDict() # type: OrderedDict[str, nodes.Item]
new_items = order_preserving_dict() # type: Dict[str, nodes.Item]
other_items = order_preserving_dict() # type: Dict[str, nodes.Item]
for item in items:
if item.nodeid not in self.cached_nodeids:
new_items[item.nodeid] = item