django-rich FTBFS when TERM=unknown

Bug #2004553 reported by Olivier Gayot
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
django-rich (Debian)
Fix Released
Unknown
django-rich (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

django-rich FTBFS on Ubuntu because the build-time test suite fails:

___________________ RichCommandTests.test_output_force_color ___________________

self = <tests.test_management.RichCommandTests testMethod=test_output_force_color>

    def test_output_force_color(self):
        stdout = StringIO()

        call_command("example", "--force-color", stdout=stdout)

> assert stdout.getvalue() == "\x1b[1;31mAlert!\x1b[0m\n"
E AssertionError: assert 'Alert!\n' == '\x1b[1;31mAlert!\x1b[0m\n'
E - Alert!
E + Alert!

This happens because the underlying python rich library disables color/style when the TERM variable is set to unknown (which is what the Ubuntu builders have):

> Setting the environment variable TERM to "dumb" or "unknown" will disable color/style and some features that require moving the cursor, such as progress bars.

https://rich.readthedocs.io/en/stable/console.html?highlight=unknown#environment-variables

Olivier Gayot (ogayot)
Changed in django-rich (Ubuntu):
assignee: nobody → Olivier Gayot (ogayot)
status: New → In Progress
Revision history for this message
Olivier Gayot (ogayot) wrote :
Changed in django-rich (Ubuntu):
status: In Progress → New
assignee: Olivier Gayot (ogayot) → nobody
Revision history for this message
Olivier Gayot (ogayot) wrote :
Revision history for this message
Olivier Gayot (ogayot) wrote (last edit ):

Adding second version of debdiff with patch that was submitted upstream.

Green build on PPA with second debdiff:
https://launchpad.net/~ogayot/+archive/ubuntu/lunar-proposed/+build/25542807

Revision history for this message
Olivier Gayot (ogayot) wrote :

Removed "Origin: upstream" from the dep3 headers, since we are the authors.

Revision history for this message
Simon Quigley (tsimonq2) wrote :

Hi Olivier, thanks for the patch.

It seems as if upstream took a slightly different approach for this issue than what is in the debdiff. Do you plan to take the updated approach, and if not, why?

Also, it seems as if your patch adds debian/patches/clear-TERM-variable.patch when it is not referenced in debian/patches/series (and is likely a duplicate of your existing patch). Please remove this or incorporate it.

Thanks, and please resubscribe sponsors when you're done.

Revision history for this message
Olivier Gayot (ogayot) wrote :

Hi Simon,

> Also, it seems as if your patch adds debian/patches/clear-TERM-variable.patch when it is not referenced in debian/patches/series (and is likely a duplicate of your existing patch). Please remove this or incorporate it.

Oops, my bad! Thanks for spotting this.
TIL -r option of quilt delete :)

> It seems as if upstream took a slightly different approach for this issue than what is in the debdiff. Do you plan to take the updated approach, and if not, why?

My line of thought was that keeping the implementation from the debdiff was fine since:
1. I had already tested it and was confident it solves the build issue.
2. the patch is meant to be dropped as soon as we get a new upstream and sync anyway :)

That said, since I needed to remove the clear-TERM-variable.patch cruft, I took the opportunity to replace my patch with the one applied upstream.

Green build:
https://launchpad.net/~ogayot/+archive/ubuntu/lunar-proposed/+build/25545163

Thanks

Revision history for this message
Simon Quigley (tsimonq2) wrote (last edit ):

Looks good to me, uploaded. Don't forget to submit your updated patch to Debian.

Thank you!

Changed in django-rich (Ubuntu):
status: New → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package django-rich - 1.4.0-5ubuntu1

---------------
django-rich (1.4.0-5ubuntu1) lunar; urgency=medium

  * make test-suite insensitive to the TERM variable to fix FTBFS when
    TERM=unknown (LP: #2004553)

 -- Olivier Gayot <email address hidden> Thu, 02 Feb 2023 12:05:10 +0100

Changed in django-rich (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Olivier Gayot (ogayot) wrote :

> Looks good to me, uploaded. Don't forget to submit your updated patch to Debian.

Thanks! Patch submitted to Debian.

Changed in django-rich (Debian):
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.