Merge pull request #7292 from kerizane/7259_iniconfig

This commit is contained in:
Bruno Oliveira 2020-06-03 19:00:48 -03:00 committed by GitHub
commit cf640a9b67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 4 deletions

View File

@ -0,0 +1 @@
Replaced ``py.iniconfig`` with `iniconfig <https://pypi.org/project/iniconfig/>`__.

View File

@ -12,6 +12,7 @@ INSTALL_REQUIRES = [
'colorama;sys_platform=="win32"',
"pluggy>=0.12,<1.0",
'importlib-metadata>=0.12;python_version<"3.8"',
"iniconfig",
]

View File

@ -6,6 +6,8 @@ from typing import Optional
from typing import Tuple
import py
from iniconfig import IniConfig
from iniconfig import ParseError
from .exceptions import UsageError
from _pytest.compat import TYPE_CHECKING
@ -40,8 +42,8 @@ def getcfg(args, config=None):
p = base.join(inibasename)
if exists(p):
try:
iniconfig = py.iniconfig.IniConfig(p)
except py.iniconfig.ParseError as exc:
iniconfig = IniConfig(p)
except ParseError as exc:
raise UsageError(str(exc))
if (
@ -119,7 +121,7 @@ def determine_setup(
) -> Tuple[py.path.local, Optional[str], Any]:
dirs = get_dirs_from_args(args)
if inifile:
iniconfig = py.iniconfig.IniConfig(inifile)
iniconfig = IniConfig(inifile)
is_cfg_file = str(inifile).endswith(".cfg")
sections = ["tool:pytest", "pytest"] if is_cfg_file else ["pytest"]
for section in sections:

View File

@ -21,6 +21,7 @@ from typing import Union
from weakref import WeakKeyDictionary
import py
from iniconfig import IniConfig
import pytest
from _pytest import timing
@ -683,7 +684,7 @@ class Testdir:
def getinicfg(self, source):
"""Return the pytest section from the tox.ini config file."""
p = self.makeini(source)
return py.iniconfig.IniConfig(p)["pytest"]
return IniConfig(p)["pytest"]
def makepyfile(self, *args, **kwargs):
r"""Shortcut for .makefile() with a .py extension.