Azure / pytest-azurepipelines

Plugin for pytest that makes it simple to work with Azure Pipelines
MIT License
112 stars 35 forks source link

`pytest-nunit` error after upgrading to `v1.0.2` #62

Closed cdkini closed 2 years ago

cdkini commented 2 years ago

Hey there! Really appreciate all the hard work you've done here 🙇🏽

I'm currently using this package in my team's Azure pipelines and ended up hitting a bug with this latest release.

2022-03-15T14:16:04.9052177Z INTERNALERROR> Traceback (most recent call last):
2022-03-15T14:16:04.9053538Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/_pytest/main.py", line 191, in wrap_session
2022-03-15T14:16:04.9054460Z INTERNALERROR>     session.exitstatus = doit(config, session) or 0
2022-03-15T14:16:04.9055360Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/_pytest/main.py", line 247, in _main
2022-03-15T14:16:04.9056034Z INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
2022-03-15T14:16:04.9056942Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
2022-03-15T14:16:04.9057596Z INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
2022-03-15T14:16:04.9058528Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
2022-03-15T14:16:04.9059189Z INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
2022-03-15T14:16:04.9060097Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
2022-03-15T14:16:04.9060775Z INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
2022-03-15T14:16:04.9061732Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
2022-03-15T14:16:04.9062345Z INTERNALERROR>     return outcome.get_result()
2022-03-15T14:16:04.9063190Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
2022-03-15T14:16:04.9063812Z INTERNALERROR>     raise ex[1].with_traceback(ex[2])
2022-03-15T14:16:04.9064684Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
2022-03-15T14:16:04.9065290Z INTERNALERROR>     res = hook_impl.function(*args)
2022-03-15T14:16:04.9066188Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/_pytest/main.py", line 272, in pytest_runtestloop
2022-03-15T14:16:04.9067851Z INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
2022-03-15T14:16:04.9069479Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
2022-03-15T14:16:04.9070237Z INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
2022-03-15T14:16:04.9071213Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
2022-03-15T14:16:04.9071860Z INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
2022-03-15T14:16:04.9072778Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
2022-03-15T14:16:04.9073472Z INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
2022-03-15T14:16:04.9074416Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
2022-03-15T14:16:04.9075368Z INTERNALERROR>     return outcome.get_result()
2022-03-15T14:16:04.9076403Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
2022-03-15T14:16:04.9077032Z INTERNALERROR>     raise ex[1].with_traceback(ex[2])
2022-03-15T14:16:04.9077898Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
2022-03-15T14:16:04.9078526Z INTERNALERROR>     res = hook_impl.function(*args)
2022-03-15T14:16:04.9079444Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/_pytest/runner.py", line 85, in pytest_runtest_protocol
2022-03-15T14:16:04.9080103Z INTERNALERROR>     runtestprotocol(item, nextitem=nextitem)
2022-03-15T14:16:04.9081013Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/_pytest/runner.py", line 94, in runtestprotocol
2022-03-15T14:16:04.9081674Z INTERNALERROR>     rep = call_and_report(item, "setup", log)
2022-03-15T14:16:04.9082579Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/_pytest/runner.py", line 190, in call_and_report
2022-03-15T14:16:04.9083245Z INTERNALERROR>     hook.pytest_runtest_logreport(report=report)
2022-03-15T14:16:04.9084142Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
2022-03-15T14:16:04.9084798Z INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
2022-03-15T14:16:04.9085722Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
2022-03-15T14:16:04.9086385Z INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
2022-03-15T14:16:04.9087276Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
2022-03-15T14:16:04.9087971Z INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
2022-03-15T14:16:04.9088929Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
2022-03-15T14:16:04.9089528Z INTERNALERROR>     return outcome.get_result()
2022-03-15T14:16:04.9090394Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
2022-03-15T14:16:04.9091017Z INTERNALERROR>     raise ex[1].with_traceback(ex[2])
2022-03-15T14:16:04.9091882Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
2022-03-15T14:16:04.9092502Z INTERNALERROR>     res = hook_impl.function(*args)
2022-03-15T14:16:04.9093442Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pytest_nunit/plugin.py", line 293, in pytest_runtest_logreport
2022-03-15T14:16:04.9096354Z INTERNALERROR>     reporter.record_testreport(report)
2022-03-15T14:16:04.9098564Z INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/pytest_nunit/plugin.py", line 146, in record_testreport
2022-03-15T14:16:04.9099241Z INTERNALERROR>     if len(testreport.longrepr) > 2:
2022-03-15T14:16:04.9099957Z INTERNALERROR> TypeError: object of type 'ExceptionChainRepr' has no len()

A similar issue was referenced in the pytest-nunit repo some time back: https://github.com/pytest-dev/pytest-nunit/issues/47

I'm running pytest with a custom wrapper script (dgtest) so I'm curious if that might be the issue. Regardless, I thought I'd open this up and see if anyone else had this problem.

Here's my configuration:

  - stage: cli_integration
    dependsOn: [scope_check, lint]
    pool:
      vmImage: 'ubuntu-latest'

    jobs:
      - job: test_cli
        condition: eq(stageDependencies.scope_check.changes.outputs['CheckChanges.GEChanged'], true)

        services:
          postgres: postgres

        variables:
          python.version: '3.8'

        steps:
          - task: UsePythonVersion@0
            inputs:
              versionSpec: '$(python.version)'
            displayName: 'Use Python $(python.version)'

          - bash: python -m pip install --upgrade pip==21.3.1
            displayName: 'Update pip'

          - script: |
              sudo apt-get install -y pandoc
              pip install pypandoc
            displayName: 'Install pandoc'

          - script: |
              pip install --requirement requirements-dev-base.txt --requirement requirements-dev-spark.txt --requirement requirements-dev-sqlalchemy.txt --constraint constraints-dev.txt
              pip install --requirement requirements.txt
              pip install .
            displayName: 'Install dependencies'

          - script: |
              # Install dependencies
              pip install pytest pytest-azurepipelines==1.0.1 # This pin fixes the issue
              git clone https://github.com/superconductive/dgtest.git
              pip install -e dgtest

              # Run dgtest
              dgtest run great_expectations --filter 'tests/cli' --aws-integration -v

            displayName: 'dgtest'
tonybaloney commented 2 years ago

Thanks for the report. What additional Pytest extensions do you have?

tonybaloney commented 2 years ago

Fixed the downstream bug, updating the deps now

tonybaloney commented 2 years ago

Fixed in 1.0.3