Repository: pytest-dev/pytest
File: testing/acceptance_test.py (Python)

Code before:
                assert data
            """
        )
        res = pytester.runpytest(p)
        res.assert_outcomes(passed=3)

    @pytest.mark.filterwarnings("ignore:'encoding' argument not specified")
    def test_command_line_args_from_file(
        self, pytester: Pytester, tmp_path: Path
    ) -> None:
        pytester.makepyfile(
            test_file="""
            import pytest

            class TestClass:
                @pytest.mark.parametrize("a", ["x","y"])
                def test_func(self, a):
                    pass
            """
        )
        tests = [
            "test_file.py::TestClass::test_func[x]",
            "test_file.py::TestClass::test_func[y]",
        ]
        args_file = pytester.maketxtfile(tests="\n".join(tests))
        result = pytester.runpytest(f"@{args_file.absolute()}")
        result.assert_outcomes(failed=0, passed=2)


class TestInvocationVariants:
    def test_earlyinit(self, pytester: Pytester) -> None:
        p = pytester.makepyfile(
            """
            import pytest
            assert hasattr(pytest, 'mark')
        """
        )
        result = pytester.runpython(p)
        assert result.ret == 0

    def test_pydoc(self, pytester: Pytester) -> None:
        result = pytester.runpython_c("import pytest;help(pytest)")
        assert result.ret == 0
        s = result.stdout.str()
        assert "MarkGenerator" in s

    def test_import_star_pytest(self, pytester: Pytester) -> None:
        p = pytester.makepyfile(
            """
            from pytest import *
            #Item

Review comment (suggestion):
Let's add some flag to ensure it remains working:

```suggestion
            "test_file.py::TestClass::test_func[y]",
            "-q",
```

Code after:
                assert data
            """
        )
        res = pytester.runpytest(p)
        res.assert_outcomes(passed=3)

    # Warning ignore because of:
    # https://github.com/python/cpython/issues/85308
    # Can be removed once Python<3.12 support is dropped.
    @pytest.mark.filterwarnings("ignore:'encoding' argument not specified")
    def test_command_line_args_from_file(
        self, pytester: Pytester, tmp_path: Path
    ) -> None:
        pytester.makepyfile(
            test_file="""
            import pytest

            class TestClass:
                @pytest.mark.parametrize("a", ["x","y"])
                def test_func(self, a):
                    pass
            """
        )
        tests = [
            "test_file.py::TestClass::test_func[x]",
            "test_file.py::TestClass::test_func[y]",
            "-q",
        ]
        args_file = pytester.maketxtfile(tests="\n".join(tests))
        result = pytester.runpytest(f"@{args_file}")
        result.assert_outcomes(failed=0, passed=2)


class TestInvocationVariants:
    def test_earlyinit(self, pytester: Pytester) -> None:
        p = pytester.makepyfile(
            """
            import pytest
            assert hasattr(pytest, 'mark')
        """
        )
        result = pytester.runpython(p)
        assert result.ret == 0

    def test_pydoc(self, pytester: Pytester) -> None:
        result = pytester.runpython_c("import pytest;help(pytest)")
        assert result.ret == 0
        s = result.stdout.str()
        assert "MarkGenerator" in s

    def test_import_star_pytest(self, pytester: Pytester) -> None: