JetBrains / teamcity-messages

Python Unit Test Reporting to TeamCity
https://pypi.python.org/pypi/teamcity-messages
Apache License 2.0
137 stars 81 forks source link

coverage 7.5+: AttributeError: 'PythonFileReporter' object has no attribute 'name' #282

Open yamnikov-oleg opened 5 months ago

yamnikov-oleg commented 5 months ago

coverage 7.5.0 is the first version which causes the error below. Downgrading to coverage 7.4.4 helps.

  Coverage statistics reporting failed
  Traceback (most recent call last):
    File "/usr/local/lib/python3.11/site-packages/teamcity/pytest_plugin.py", line 395, in report
      analysis = self.coverage._analyze(cu)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/site-packages/coverage/control.py", line 940, in _analyze
      file_reporter = self._get_file_reporter(morf)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  TypeError: unhashable type: 'PythonFileReporter'

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/usr/local/lib/python3.11/site-packages/teamcity/pytest_plugin.py", line 335, in pytest_terminal_summary
      self._report_coverage()
    File "/usr/local/lib/python3.11/site-packages/teamcity/pytest_plugin.py", line 432, in _report_coverage
      reporter.report(None)
    File "/usr/local/lib/python3.11/site-packages/teamcity/pytest_plugin.py", line 409, in report
      test_id = cu.name
                ^^^^^^^
  AttributeError: 'PythonFileReporter' object has no attribute 'name'
zaufi commented 3 months ago

I also faced this!

RichardDally commented 2 months ago

coverage 7.5.0 is the first version which causes the error below. Downgrading to coverage 7.4.4 helps.


  Coverage statistics reporting failed

  Traceback (most recent call last):

    File "/usr/local/lib/python3.11/site-packages/teamcity/pytest_plugin.py", line 395, in report

      analysis = self.coverage._analyze(cu)

                 ^^^^^^^^^^^^^^^^^^^^^^^^^^

    File "/usr/local/lib/python3.11/site-packages/coverage/control.py", line 940, in _analyze

      file_reporter = self._get_file_reporter(morf)

                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  TypeError: unhashable type: 'PythonFileReporter'

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):

    File "/usr/local/lib/python3.11/site-packages/teamcity/pytest_plugin.py", line 335, in pytest_terminal_summary

      self._report_coverage()

    File "/usr/local/lib/python3.11/site-packages/teamcity/pytest_plugin.py", line 432, in _report_coverage

      reporter.report(None)

    File "/usr/local/lib/python3.11/site-packages/teamcity/pytest_plugin.py", line 409, in report

      test_id = cu.name

                ^^^^^^^

  AttributeError: 'PythonFileReporter' object has no attribute 'name'

Thank you, it worked for us. We are now waiting a bugfix from Jetbrains 😀