summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRan Benita <ran@unusedvar.com>2020-12-18 20:33:39 +0200
committerRan Benita <ran@unusedvar.com>2020-12-19 13:33:34 +0200
commit73586be08fe33c483ae3c3509a05459969ba2ab9 (patch)
treed65ae7b59c1d23c7f27ecb98297dea112e3bf535 /src
parent89dcfbf293802b6efacc5aea2893f9fec03787bc (diff)
downloadpytest-73586be08fe33c483ae3c3509a05459969ba2ab9.tar.gz
terminal: remove unused union arm in WarningReport.fslocation
Diffstat (limited to 'src')
-rw-r--r--src/_pytest/terminal.py17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/_pytest/terminal.py b/src/_pytest/terminal.py
index f5d4e1f8d..d3d1a4b66 100644
--- a/src/_pytest/terminal.py
+++ b/src/_pytest/terminal.py
@@ -285,15 +285,13 @@ class WarningReport:
User friendly message about the warning.
:ivar str|None nodeid:
nodeid that generated the warning (see ``get_location``).
- :ivar tuple|py.path.local fslocation:
+ :ivar tuple fslocation:
File system location of the source of the warning (see ``get_location``).
"""
message = attr.ib(type=str)
nodeid = attr.ib(type=Optional[str], default=None)
- fslocation = attr.ib(
- type=Optional[Union[Tuple[str, int], py.path.local]], default=None
- )
+ fslocation = attr.ib(type=Optional[Tuple[str, int]], default=None)
count_towards_summary = True
def get_location(self, config: Config) -> Optional[str]:
@@ -301,14 +299,9 @@ class WarningReport:
if self.nodeid:
return self.nodeid
if self.fslocation:
- if isinstance(self.fslocation, tuple) and len(self.fslocation) >= 2:
- filename, linenum = self.fslocation[:2]
- relpath = bestrelpath(
- config.invocation_params.dir, absolutepath(filename)
- )
- return f"{relpath}:{linenum}"
- else:
- return str(self.fslocation)
+ filename, linenum = self.fslocation
+ relpath = bestrelpath(config.invocation_params.dir, absolutepath(filename))
+ return f"{relpath}:{linenum}"
return None