diff options
author | Ran Benita <ran@unusedvar.com> | 2020-10-17 18:18:24 +0300 |
---|---|---|
committer | Ran Benita <ran@unusedvar.com> | 2020-10-17 19:25:45 +0300 |
commit | e5e47c1097e6f9e7bd30e28d508dca489f0629c6 (patch) | |
tree | ab37654ba51028d04587db42d5230bf60bbbc15e /src/_pytest/pytester.py | |
parent | 0a258f534f9c295703daadd70b1c8e93e788730a (diff) | |
download | pytest-e5e47c1097e6f9e7bd30e28d508dca489f0629c6.tar.gz |
Fix typing related to iniconfig
iniconfig now has typing stubs which reveal a couple issues.
Diffstat (limited to 'src/_pytest/pytester.py')
-rw-r--r-- | src/_pytest/pytester.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/_pytest/pytester.py b/src/_pytest/pytester.py index e3094a9df..a4142037d 100644 --- a/src/_pytest/pytester.py +++ b/src/_pytest/pytester.py @@ -32,6 +32,7 @@ from weakref import WeakKeyDictionary import attr import py from iniconfig import IniConfig +from iniconfig import SectionWrapper import pytest from _pytest import timing @@ -785,10 +786,10 @@ class Pytester: """Write a tox.ini file with 'source' as contents.""" return self.makefile(".ini", tox=source) - def getinicfg(self, source: str) -> IniConfig: + def getinicfg(self, source: str) -> SectionWrapper: """Return the pytest section from the tox.ini config file.""" p = self.makeini(source) - return IniConfig(p)["pytest"] + return IniConfig(str(p))["pytest"] def makepyprojecttoml(self, source: str) -> Path: """Write a pyproject.toml file with 'source' as contents. @@ -1541,9 +1542,9 @@ class Testdir: """See :meth:`Pytester.makeini`.""" return py.path.local(str(self._pytester.makeini(source))) - def getinicfg(self, source) -> py.path.local: + def getinicfg(self, source: str) -> SectionWrapper: """See :meth:`Pytester.getinicfg`.""" - return py.path.local(str(self._pytester.getinicfg(source))) + return self._pytester.getinicfg(source) def makepyprojecttoml(self, source) -> py.path.local: """See :meth:`Pytester.makepyprojecttoml`.""" |