|
32 | 32 | import attr |
33 | 33 | import py |
34 | 34 | from iniconfig import IniConfig |
| 35 | +from iniconfig import SectionWrapper |
35 | 36 |
|
36 | 37 | import pytest |
37 | 38 | from _pytest import timing |
@@ -785,10 +786,10 @@ def makeini(self, source: str) -> Path: |
785 | 786 | """Write a tox.ini file with 'source' as contents.""" |
786 | 787 | return self.makefile(".ini", tox=source) |
787 | 788 |
|
788 | | - def getinicfg(self, source: str) -> IniConfig: |
| 789 | + def getinicfg(self, source: str) -> SectionWrapper: |
789 | 790 | """Return the pytest section from the tox.ini config file.""" |
790 | 791 | p = self.makeini(source) |
791 | | - return IniConfig(p)["pytest"] |
| 792 | + return IniConfig(str(p))["pytest"] |
792 | 793 |
|
793 | 794 | def makepyprojecttoml(self, source: str) -> Path: |
794 | 795 | """Write a pyproject.toml file with 'source' as contents. |
@@ -1321,8 +1322,10 @@ def run( |
1321 | 1322 | """ |
1322 | 1323 | __tracebackhide__ = True |
1323 | 1324 |
|
| 1325 | + # TODO: Remove type ignore in next mypy release. |
| 1326 | + # https://github.com/python/typeshed/pull/4582 |
1324 | 1327 | cmdargs = tuple( |
1325 | | - os.fspath(arg) if isinstance(arg, os.PathLike) else arg for arg in cmdargs |
| 1328 | + os.fspath(arg) if isinstance(arg, os.PathLike) else arg for arg in cmdargs # type: ignore[misc] |
1326 | 1329 | ) |
1327 | 1330 | p1 = self.path.joinpath("stdout") |
1328 | 1331 | p2 = self.path.joinpath("stderr") |
@@ -1541,9 +1544,9 @@ def makeini(self, source) -> py.path.local: |
1541 | 1544 | """See :meth:`Pytester.makeini`.""" |
1542 | 1545 | return py.path.local(str(self._pytester.makeini(source))) |
1543 | 1546 |
|
1544 | | - def getinicfg(self, source) -> py.path.local: |
| 1547 | + def getinicfg(self, source: str) -> SectionWrapper: |
1545 | 1548 | """See :meth:`Pytester.getinicfg`.""" |
1546 | | - return py.path.local(str(self._pytester.getinicfg(source))) |
| 1549 | + return self._pytester.getinicfg(source) |
1547 | 1550 |
|
1548 | 1551 | def makepyprojecttoml(self, source) -> py.path.local: |
1549 | 1552 | """See :meth:`Pytester.makepyprojecttoml`.""" |
|
0 commit comments