Remove/replace some unneeded usages of py.path

This commit is contained in:
Ran Benita
2021-03-13 21:22:54 +02:00
parent cdbeb03aef
commit 59251e8a2a
18 changed files with 102 additions and 105 deletions

View File

@@ -3,9 +3,9 @@ import os
import shlex
import subprocess
import sys
from pathlib import Path
import pytest
from _pytest.compat import legacy_path
from _pytest.config import argparsing as parseopt
from _pytest.config.exceptions import UsageError
from _pytest.monkeypatch import MonkeyPatch
@@ -123,11 +123,11 @@ class TestParser:
assert not getattr(args, parseopt.FILE_OR_DIR)
def test_parse2(self, parser: parseopt.Parser) -> None:
args = parser.parse([legacy_path(".")])
assert getattr(args, parseopt.FILE_OR_DIR)[0] == legacy_path(".")
args = parser.parse([Path(".")])
assert getattr(args, parseopt.FILE_OR_DIR)[0] == "."
def test_parse_known_args(self, parser: parseopt.Parser) -> None:
parser.parse_known_args([legacy_path(".")])
parser.parse_known_args([Path(".")])
parser.addoption("--hello", action="store_true")
ns = parser.parse_known_args(["x", "--y", "--hello", "this"])
assert ns.hello