evhub/cpyparsing

2.4.7.2.3.2: pytest is failing with many errors

Closed this issue · 3 comments

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix> using 'installer` module
  • run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
  • build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")

2.4.7.2.3.1 was OK.

Here is list of installed modules in build env

Package            Version
------------------ -------
boltons            23.0.0
build              1.0.3
cppclean           0.13
Cython             3.0.5
distro             1.8.0
dnf                4.18.1
exceptiongroup     1.1.3
funcsigs           1.0.2
gpg                1.23.0
importlib-metadata 6.8.0
iniconfig          2.0.0
installer          0.7.0
libdnf             0.72.0
packaging          23.2
pluggy             1.3.0
pyparsing          3.1.1
pyproject_hooks    1.0.0
pytest             7.4.3
python-dateutil    2.8.2
railroad           0.5.0
setuptools         69.0.2
six                1.16.0
tomli              2.0.1
toolz              0.12.0
wheel              0.41.3
zipp               3.17.0

Here is pytest output:

2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
============================= test session starts ==============================
platform linux -- Python 3.8.18, pytest-7.4.3, pluggy-1.3.0
rootdir: /home/tkloczko/rpmbuild/BUILD/cpyparsing-2.4.7.2.3.2
collected 120 items

tests/cPyparsing_test.py EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE [ 39%]
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE          [ 91%]
tests/examples/test_bibparse.py ..........                               [100%]

==================================== ERRORS ====================================
___________________ ERROR at setup of ParseTestCase.runTest ____________________

cls = <class '_pytest.runner.CallInfo'>
func = <function call_runtest_hook.<locals>.<lambda> at 0x7fc80e727670>
when = 'setup'
reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)

    @classmethod
    def from_call(
        cls,
        func: "Callable[[], TResult]",
        when: "Literal['collect', 'setup', 'call', 'teardown']",
        reraise: Optional[
            Union[Type[BaseException], Tuple[Type[BaseException], ...]]
        ] = None,
    ) -> "CallInfo[TResult]":
        """Call func, wrapping the result in a CallInfo.

        :param func:
            The function to call. Called without arguments.
        :param when:
            The phase in which the function is called.
        :param reraise:
            Exception or exceptions that shall propagate if raised by the
            function, instead of being wrapped in the CallInfo.
        """
        excinfo = None
        start = timing.time()
        precise_start = timing.perf_counter()
        try:
>           result: Optional[TResult] = func()

/usr/lib/python3.8/site-packages/_pytest/runner.py:341:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/_pytest/runner.py:262: in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
/usr/lib/python3.8/site-packages/pluggy/_hooks.py:493: in __call__
    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
/usr/lib/python3.8/site-packages/pluggy/_manager.py:115: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/usr/lib/python3.8/site-packages/_pytest/runner.py:157: in pytest_runtest_setup
    item.session._setupstate.setup(item)
/usr/lib/python3.8/site-packages/_pytest/runner.py:497: in setup
    raise exc
/usr/lib/python3.8/site-packages/_pytest/runner.py:494: in setup
    col.setup()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <TestCaseFunction runTest>

    def setup(self) -> None:
        # A bound method to be called during teardown() if set (see 'runtest()').
        self._explicit_tearDown: Optional[Callable[[], None]] = None
        assert self.parent is not None
>       self._testcase = self.parent.obj(self.name)  # type: ignore[attr-defined]
E       TypeError: __init__() takes 1 positional argument but 2 were given

/usr/lib/python3.8/site-packages/_pytest/unittest.py:201: TypeError
_________________ ERROR at setup of PyparsingTestInit.runTest __________________

cls = <class '_pytest.runner.CallInfo'>
func = <function call_runtest_hook.<locals>.<lambda> at 0x7fc80e3d65e0>
when = 'setup'
reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)

    @classmethod
    def from_call(
        cls,
        func: "Callable[[], TResult]",
        when: "Literal['collect', 'setup', 'call', 'teardown']",
        reraise: Optional[
            Union[Type[BaseException], Tuple[Type[BaseException], ...]]
        ] = None,
    ) -> "CallInfo[TResult]":
        """Call func, wrapping the result in a CallInfo.

        :param func:
            The function to call. Called without arguments.
        :param when:
            The phase in which the function is called.
        :param reraise:
            Exception or exceptions that shall propagate if raised by the
            function, instead of being wrapped in the CallInfo.
        """
        excinfo = None
        start = timing.time()
        precise_start = timing.perf_counter()
        try:
>           result: Optional[TResult] = func()

/usr/lib/python3.8/site-packages/_pytest/runner.py:341:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/_pytest/runner.py:262: in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
/usr/lib/python3.8/site-packages/pluggy/_hooks.py:493: in __call__
    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
/usr/lib/python3.8/site-packages/pluggy/_manager.py:115: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/usr/lib/python3.8/site-packages/_pytest/runner.py:157: in pytest_runtest_setup
    item.session._setupstate.setup(item)
/usr/lib/python3.8/site-packages/_pytest/runner.py:497: in setup
    raise exc
/usr/lib/python3.8/site-packages/_pytest/runner.py:494: in setup
    col.setup()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <TestCaseFunction runTest>

    def setup(self) -> None:
        # A bound method to be called during teardown() if set (see 'runtest()').
        self._explicit_tearDown: Optional[Callable[[], None]] = None
        assert self.parent is not None
>       self._testcase = self.parent.obj(self.name)  # type: ignore[attr-defined]
E       TypeError: __init__() takes 1 positional argument but 2 were given

/usr/lib/python3.8/site-packages/_pytest/unittest.py:201: TypeError
__________________ ERROR at setup of ParseFourFnTest.runTest ___________________

cls = <class '_pytest.runner.CallInfo'>
func = <function call_runtest_hook.<locals>.<lambda> at 0x7fc80dc624c0>
when = 'setup'
reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)

    @classmethod
    def from_call(
        cls,
        func: "Callable[[], TResult]",
        when: "Literal['collect', 'setup', 'call', 'teardown']",
        reraise: Optional[
            Union[Type[BaseException], Tuple[Type[BaseException], ...]]
        ] = None,
    ) -> "CallInfo[TResult]":
        """Call func, wrapping the result in a CallInfo.

        :param func:
            The function to call. Called without arguments.
        :param when:
            The phase in which the function is called.
        :param reraise:
            Exception or exceptions that shall propagate if raised by the
            function, instead of being wrapped in the CallInfo.
        """
        excinfo = None
        start = timing.time()
        precise_start = timing.perf_counter()
        try:
>           result: Optional[TResult] = func()

/usr/lib/python3.8/site-packages/_pytest/runner.py:341:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/_pytest/runner.py:262: in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
/usr/lib/python3.8/site-packages/pluggy/_hooks.py:493: in __call__
    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
/usr/lib/python3.8/site-packages/pluggy/_manager.py:115: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/usr/lib/python3.8/site-packages/_pytest/runner.py:157: in pytest_runtest_setup
    item.session._setupstate.setup(item)
/usr/lib/python3.8/site-packages/_pytest/runner.py:497: in setup
    raise exc
/usr/lib/python3.8/site-packages/_pytest/runner.py:494: in setup
    col.setup()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <TestCaseFunction runTest>

    def setup(self) -> None:
        # A bound method to be called during teardown() if set (see 'runtest()').
        self._explicit_tearDown: Optional[Callable[[], None]] = None
        assert self.parent is not None
>       self._testcase = self.parent.obj(self.name)  # type: ignore[attr-defined]
E       TypeError: __init__() takes 1 positional argument but 2 were given

/usr/lib/python3.8/site-packages/_pytest/unittest.py:201: TypeError

[.other units are failing with similar errors.]

=============================== warnings summary ===============================
../../../../../usr/lib64/python3.8/unittest/suite.py:92
  /usr/lib64/python3.8/unittest/suite.py:92: PytestCollectionWarning: cannot collect test class 'TestSuite' because it has a __init__ constructor (from: tests/cPyparsing_test.py)
    class TestSuite(BaseTestSuite):

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
ERROR tests/cPyparsing_test.py::ParseTestCase::runTest - TypeError: __init__(...
ERROR tests/cPyparsing_test.py::PyparsingTestInit::runTest - TypeError: __ini...
ERROR tests/cPyparsing_test.py::ParseFourFnTest::runTest - TypeError: __init_...
ERROR tests/cPyparsing_test.py::ParseSQLTest::runTest - TypeError: __init__()...
ERROR tests/cPyparsing_test.py::ParseConfigFileTest::runTest - TypeError: __i...
ERROR tests/cPyparsing_test.py::ParseJSONDataTest::runTest - TypeError: __ini...
ERROR tests/cPyparsing_test.py::ParseCommaSeparatedValuesTest::runTest - Type...
ERROR tests/cPyparsing_test.py::ParseEBNFTest::runTest - TypeError: __init__(...
ERROR tests/cPyparsing_test.py::ParseIDLTest::runTest - TypeError: __init__()...
ERROR tests/cPyparsing_test.py::ParseVerilogTest::runTest - TypeError: __init...
ERROR tests/cPyparsing_test.py::ScanStringTest::runTest - TypeError: __init__...
ERROR tests/cPyparsing_test.py::QuotedStringsTest::runTest - TypeError: __ini...
ERROR tests/cPyparsing_test.py::CaselessOneOfTest::runTest - TypeError: __ini...
ERROR tests/cPyparsing_test.py::AsXMLTest::runTest - TypeError: __init__() ta...
ERROR tests/cPyparsing_test.py::AsXMLTest2::runTest - TypeError: __init__() t...
ERROR tests/cPyparsing_test.py::CommentParserTest::runTest - TypeError: __ini...
ERROR tests/cPyparsing_test.py::ParseExpressionResultsTest::runTest - TypeErr...
ERROR tests/cPyparsing_test.py::ParseKeywordTest::runTest - TypeError: __init...
ERROR tests/cPyparsing_test.py::ParseExpressionResultsAccumulateTest::runTest
ERROR tests/cPyparsing_test.py::ReStringRangeTest::runTest - TypeError: __ini...
ERROR tests/cPyparsing_test.py::SkipToParserTests::runTest - TypeError: __ini...
ERROR tests/cPyparsing_test.py::EllipsisRepetionTest::runTest - TypeError: __...
ERROR tests/cPyparsing_test.py::CustomQuotesTest::runTest - TypeError: __init...
ERROR tests/cPyparsing_test.py::RepeaterTest::runTest - TypeError: __init__()...
ERROR tests/cPyparsing_test.py::RecursiveCombineTest::runTest - TypeError: __...
ERROR tests/cPyparsing_test.py::InfixNotationGrammarTest1::runTest - TypeErro...
ERROR tests/cPyparsing_test.py::InfixNotationGrammarTest2::runTest - TypeErro...
ERROR tests/cPyparsing_test.py::InfixNotationGrammarTest3::runTest - TypeErro...
ERROR tests/cPyparsing_test.py::InfixNotationGrammarTest4::runTest - TypeErro...
ERROR tests/cPyparsing_test.py::InfixNotationGrammarTest5::runTest - TypeErro...
ERROR tests/cPyparsing_test.py::ParseResultsPickleTest::runTest - TypeError: ...
ERROR tests/cPyparsing_test.py::ParseResultsWithNamedTupleTest::runTest - Typ...
ERROR tests/cPyparsing_test.py::ParseHTMLTagsTest::runTest - TypeError: __ini...
ERROR tests/cPyparsing_test.py::UpcaseDowncaseUnicode::runTest - TypeError: _...
ERROR tests/cPyparsing_test.py::ParseUsingRegex::runTest - TypeError: __init_...
ERROR tests/cPyparsing_test.py::RegexAsTypeTest::runTest - TypeError: __init_...
ERROR tests/cPyparsing_test.py::RegexSubTest::runTest - TypeError: __init__()...
ERROR tests/cPyparsing_test.py::PrecededByTest::runTest - TypeError: __init__...
ERROR tests/cPyparsing_test.py::CountedArrayTest::runTest - TypeError: __init...
ERROR tests/cPyparsing_test.py::CountedArrayTest2::runTest - TypeError: __ini...
ERROR tests/cPyparsing_test.py::CountedArrayTest3::runTest - TypeError: __ini...
ERROR tests/cPyparsing_test.py::LineStartTest::runTest - TypeError: __init__(...
ERROR tests/cPyparsing_test.py::LineAndStringEndTest::runTest - TypeError: __...
ERROR tests/cPyparsing_test.py::VariableParseActionArgsTest::runTest - TypeEr...
ERROR tests/cPyparsing_test.py::EnablePackratParsing::runTest - TypeError: __...
ERROR tests/cPyparsing_test.py::SingleArgExceptionTest::runTest - TypeError: ...
ERROR tests/cPyparsing_test.py::OriginalTextForTest::runTest - TypeError: __i...
ERROR tests/cPyparsing_test.py::PackratParsingCacheCopyTest::runTest - TypeEr...
ERROR tests/cPyparsing_test.py::PackratParsingCacheCopyTest2::runTest - TypeE...
ERROR tests/cPyparsing_test.py::ParseResultsDelTest::runTest - TypeError: __i...
ERROR tests/cPyparsing_test.py::WithAttributeParseActionTest::runTest - TypeE...
ERROR tests/cPyparsing_test.py::NestedExpressionsTest::runTest - TypeError: _...
ERROR tests/cPyparsing_test.py::WordExcludeTest::runTest - TypeError: __init_...
ERROR tests/cPyparsing_test.py::ParseAllTest::runTest - TypeError: __init__()...
ERROR tests/cPyparsing_test.py::GreedyQuotedStringsTest::runTest - TypeError:...
ERROR tests/cPyparsing_test.py::WordBoundaryExpressionsTest::runTest - TypeEr...
ERROR tests/cPyparsing_test.py::RequiredEachTest::runTest - TypeError: __init...
ERROR tests/cPyparsing_test.py::OptionalEachTest::testParseExpressionsWithRegex
ERROR tests/cPyparsing_test.py::SumParseResultsTest::runTest - TypeError: __i...
ERROR tests/cPyparsing_test.py::MarkInputLineTest::runTest - TypeError: __ini...
ERROR tests/cPyparsing_test.py::LocatedExprTest::runTest - TypeError: __init_...
ERROR tests/cPyparsing_test.py::PopTest::runTest - TypeError: __init__() take...
ERROR tests/cPyparsing_test.py::AddConditionTest::runTest - TypeError: __init...
ERROR tests/cPyparsing_test.py::PatientOrTest::runTest - TypeError: __init__(...
ERROR tests/cPyparsing_test.py::EachWithOptionalWithResultsNameTest::runTest
ERROR tests/cPyparsing_test.py::UnicodeExpressionTest::runTest - TypeError: _...
ERROR tests/cPyparsing_test.py::SetNameTest::runTest - TypeError: __init__() ...
ERROR tests/cPyparsing_test.py::ClearParseActionsTest::runTest - TypeError: _...
ERROR tests/cPyparsing_test.py::OneOrMoreStopTest::runTest - TypeError: __ini...
ERROR tests/cPyparsing_test.py::ZeroOrMoreStopTest::runTest - TypeError: __in...
ERROR tests/cPyparsing_test.py::NestedAsDictTest::runTest - TypeError: __init...
ERROR tests/cPyparsing_test.py::TraceParseActionDecoratorTest::runTest - Type...
ERROR tests/cPyparsing_test.py::RunTestsTest::runTest - TypeError: __init__()...
ERROR tests/cPyparsing_test.py::RunTestsPostParseTest::runTest - TypeError: _...
ERROR tests/cPyparsing_test.py::CommonExpressionsTest::runTest - TypeError: _...
ERROR tests/cPyparsing_test.py::NumericExpressionsTest::runTest - TypeError: ...
ERROR tests/cPyparsing_test.py::TokenMapTest::runTest - TypeError: __init__()...
ERROR tests/cPyparsing_test.py::ParseFileTest::runTest - TypeError: __init__(...
ERROR tests/cPyparsing_test.py::HTMLStripperTest::runTest - TypeError: __init...
ERROR tests/cPyparsing_test.py::ExprSplitterTest::runTest - TypeError: __init...
ERROR tests/cPyparsing_test.py::ParseFatalExceptionTest::runTest - TypeError:...
ERROR tests/cPyparsing_test.py::InlineLiteralsUsingTest::runTest - TypeError:...
ERROR tests/cPyparsing_test.py::CloseMatchTest::runTest - TypeError: __init__...
ERROR tests/cPyparsing_test.py::DefaultKeywordCharsTest::runTest - TypeError:...
ERROR tests/cPyparsing_test.py::ColTest::runTest - TypeError: __init__() take...
ERROR tests/cPyparsing_test.py::LiteralExceptionTest::runTest - TypeError: __...
ERROR tests/cPyparsing_test.py::ParseActionExceptionTest::runTest - TypeError...
ERROR tests/cPyparsing_test.py::ParseActionNestingTest::runTest - TypeError: ...
ERROR tests/cPyparsing_test.py::ParseResultsNameBelowUngroupedNameTest::runTest
ERROR tests/cPyparsing_test.py::ParseResultsNamesInGroupWithDictTest::runTest
ERROR tests/cPyparsing_test.py::FollowedByTest::runTest - TypeError: __init__...
ERROR tests/cPyparsing_test.py::SetBreakTest::runTest - TypeError: __init__()...
ERROR tests/cPyparsing_test.py::UnicodeTests::runTest - TypeError: __init__()...
ERROR tests/cPyparsing_test.py::IndentedBlockExampleTest::runTest - TypeError...
ERROR tests/cPyparsing_test.py::IndentedBlockTest::runTest - TypeError: __ini...
ERROR tests/cPyparsing_test.py::IndentedBlockTest2::runTest - TypeError: __in...
ERROR tests/cPyparsing_test.py::IndentedBlockScanTest::runTest - TypeError: _...
ERROR tests/cPyparsing_test.py::ParseResultsWithNameMatchFirst::runTest - Typ...
ERROR tests/cPyparsing_test.py::ParseResultsWithNameOr::runTest - TypeError: ...
ERROR tests/cPyparsing_test.py::EmptyDictDoesNotRaiseException::runTest - Typ...
ERROR tests/cPyparsing_test.py::ExplainExceptionTest::runTest - TypeError: __...
ERROR tests/cPyparsing_test.py::CaselessKeywordVsKeywordCaselessTest::runTest
ERROR tests/cPyparsing_test.py::OneOfKeywordsTest::runTest - TypeError: __ini...
ERROR tests/cPyparsing_test.py::WarnUngroupedNamedTokensTest::runTest - TypeE...
ERROR tests/cPyparsing_test.py::WarnNameSetOnEmptyForwardTest::runTest - Type...
ERROR tests/cPyparsing_test.py::WarnOnMultipleStringArgsToOneOfTest::runTest
ERROR tests/cPyparsing_test.py::EnableDebugOnNamedExpressionsTest::runTest - ...
ERROR tests/cPyparsing_test.py::UndesirableButCommonPracticesTest::runTest - ...
ERROR tests/cPyparsing_test.py::ChainedTernaryOperator::runTest - TypeError: ...
ERROR tests/cPyparsing_test.py::MiscellaneousParserTests::runTest - TypeError...
================== 10 passed, 1 warning, 110 errors in 5.73s ===================

As I explained in evhub/coconut#780, please stop opening issues like this on my repositories. I am never going to fix this.

How can I recognise which one units should be skipped? 🤔
What is the problem with add those units marked for example using ci pytest mark disabled by default to not annoy people which are running pytest outside your CIs?
Is this not valid solution? 🤔