[Debian-ha-maintainers] Bug#972619: crmsh: spurious test_grep failure in autopkgtest

Colin Watson cjwatson at debian.org
Wed Oct 21 11:21:26 BST 2020


Package: crmsh
Version: 4.2.0-3
Severity: important
Justification: blocks migration of openssh to testing

https://ci.debian.net/data/autopkgtest/testing/amd64/c/crmsh/7648090/log.gz
shows what I believe to be a spurious failure:

  FAIL: unittests.test_report.test_grep
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/nose/case.py", line 197, in runTest
      self.test(*self.arg)
    File "/usr/share/crmsh/tests/unittests/test_report.py", line 238, in test_grep
      eq_(res, out.strip("\n"))
  AssertionError: 'Package: bash' != 'Package: bash\nPackage: bash'
  -------------------- >> begin captured stdout << ---------------------
  .EXT apt-cache show bash
  .EXT apt-cache show bash|grep "^Package:"
  
  --------------------- >> end captured stdout << ----------------------

The relevant code is:

    res = grep("^Package:", incmd="apt-cache show bash")[0]
    _, out = get_command_info("apt-cache show bash|grep \"^Package:\"")
    eq_(res, out.strip("\n"))

If there happen to be multiple versions of bash in the apt cache, then
grep(...)[0] will only show the first match, while the following
get_command_info() will show all of them.

I haven't tested this at all, but I suggest either something like:

    res = "\n".join(grep("^Package:", incmd="apt-cache show bash"))

... or:

    _, out = get_command_info("apt-cache show bash|grep -m1 \"^Package:\"")

Thanks,

-- 
Colin Watson (he/him)                              [cjwatson at debian.org]



More information about the Debian-ha-maintainers mailing list