coveralls-python icon indicating copy to clipboard operation
coveralls-python copied to clipboard

Tox test on Python 3.6 fails with assertion error

Open andy-maier opened this issue 3 years ago • 0 comments

On Python 3.6, the tox test fails. On Python 3.5 and 3.7 or higher, it suceeds.

  py36-cov6-default run-test: commands[0] | coverage run --branch --source=coveralls -m pytest tests/
  ============================= test session starts ==============================
  platform linux -- Python 3.6.15, pytest-7.0.1, pluggy-1.0.0
  cachedir: .tox/py36-cov6-default/.pytest_cache
  rootdir: /home/runner/work/coveralls-python/coveralls-python
  collected 73 items
  
  tests/api_test.py .                                                      [  1%]
  tests/cli_test.py ..............                                         [ 20%]
  tests/git_test.py ........                                               [ 31%]
  tests/integration_test.py ...                                            [ 35%]
  tests/api/configuration_test.py s...................                     [ 63%]
  tests/api/encoding_test.py ..                                            [ 65%]
  tests/api/exception_test.py ...                                          [ 69%]
  tests/api/reporter_test.py .......F..                                    [ 83%]
  tests/api/wear_test.py ............                                      [100%]
  
  =================================== FAILURES ===================================
  ___________________ ReporterTest.test_reporter_with_branches ___________________
  
  self = <tests.api.reporter_test.ReporterTest testMethod=test_reporter_with_branches>
  
      def test_reporter_with_branches(self):
          subprocess.call(['coverage', 'run', '--branch', '--omit=**/.tox/*',
                           'runtests.py'], cwd=EXAMPLE_DIR)
          results = Coveralls(repo_token='xxx').get_coverage()
          assert len(results) == 2
      
          # Branches are expressed as four values each in a flat list
          assert not len(results[0]['branches']) % 4
          assert not len(results[1]['branches']) % 4
      
          expected_results = self.make_test_results(with_branches=True)
  >       assert_coverage(results[0], expected_results[0])
  
  /home/runner/work/coveralls-python/coveralls-python/tests/api/reporter_test.py:176: 
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
  
  actual = {'branches': [5, 0, 6, 1, 5, 0, ...], 'coverage': [1, 1, None, None, 1, None, ...], 'name': 'project.py', 'source': 'd...1:\n        print(\'condition tested both ways\')\n    if cond2:\n        print(\'condition not tested both ways\')\n'}
  expected = {'branches': [13, 0, 14, 1, 13, 0, ...], 'coverage': [1, 1, None, None, 1, None, ...], 'name': 'project.py', 'source':...1:\n        print(\'condition tested both ways\')\n    if cond2:\n        print(\'condition not tested both ways\')\n'}
  
      def assert_coverage(actual, expected):
          assert actual['source'].strip() == expected['source'].strip()
          assert actual['name'] == expected['name']
          assert actual['coverage'] == expected['coverage']
  >       assert actual.get('branches') == expected.get('branches')
  E       assert [5, 0, 6, 1, 5, 0, ...] == [13, 0, 14, 1, 13, 0, ...]
  E         At index 0 diff: 5 != 13
  E         Left contains 8 more items, first extra item: 15
  E         Full diff:
  E         - [13, 0, 14, 1, 13, 0, 15, 1, 15, 0, 16, 1, 15, 0, 12, 0]
  E         + [5, 0, 6, 1, 5, 0, 9, 1, 13, 0, 14, 1, 13, 0, 15, 1, 15, 0, 16, 1, 15, 0, 12, 0]
  E         ?  ++++++++++++++++++++++++
  
  /home/runner/work/coveralls-python/coveralls-python/tests/api/reporter_test.py:16: AssertionError
  ----------------------------- Captured stdout call -----------------------------
  world
  condition not tested both ways
  condition tested both ways
  condition not tested both ways
  =========================== short test summary info ============================
  FAILED tests/api/reporter_test.py::ReporterTest::test_reporter_with_branches
  =================== 1 failed, 71 passed, 1 skipped in 4.23s ====================
  Error: ERROR: InvocationError for command /home/runner/work/coveralls-python/coveralls-python/.tox/py36-cov6-default/bin/coverage run --branch --source=coveralls -m pytest tests/ (exited with code 1)

This is from run https://github.com/TheKevJames/coveralls-python/actions/runs/3765789223/jobs/6401619490

andy-maier avatar Dec 23 '22 13:12 andy-maier