Skip to content

Commit

Permalink
refactor(slow-first): changed typing to support older verions of python
Browse files Browse the repository at this point in the history
  • Loading branch information
joaovitorsilvestre committed Jan 27, 2024
1 parent 41e42a9 commit 55684fa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pytest_slow_first.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import json
import logging
import os
from typing import Union
from typing import Union, Dict

import pytest
from _pytest.config import ExitCode
Expand Down Expand Up @@ -47,7 +47,7 @@ def total_duration(self) -> float:
def set_duration(self, kind: str, duration: float):
setattr(self, f"{kind}_duration", duration)

def serialize(self) -> dict[str, Union[str, float]]:
def serialize(self) -> Dict[str, Union[str, float]]:
return {'nodeid': self.nodeid, 'setup_duration': self.setup_duration,
'call_duration': self.call_duration, 'teardown_duration': self.teardown_duration}

Expand All @@ -57,10 +57,10 @@ def deserialize(data: dict) -> "Test":


class SlowFirst:
_tests_by_name: dict[str, Test]
_tests_by_name: Dict[str, Test]
enabled: bool

def __init__(self, tests_by_name: dict[str, Test] = None, enabled: bool = False):
def __init__(self, tests_by_name: Dict[str, Test] = None, enabled: bool = False):
self._tests_by_name = tests_by_name or {}
self.enabled = enabled

Expand Down

0 comments on commit 55684fa

Please sign in to comment.