Package: django-rich Severity: normal Tags: patch User: ubuntu-de...@lists.ubuntu.com Usertags: origin-ubuntu lunar ubuntu-patch
Dear Maintainer, When building on Ubuntu, the build-time test suite fails with the following error: 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 - [1;31mAlert![0m 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 Although currently Debian is not affected (I believe builders have a different value for TERM), it feels wrong that the build-time test-suite would depend on the TERM environment variable. Therefore, I think the patch still makes sense. In Ubuntu, the attached patch was applied to achieve the following: * clear TERM variable when running build test suite since python-rich disables color/style when TERM=unknown (LP: #2004553) Thanks for considering the patch. -- System Information: Debian Release: bookworm/sid APT prefers kinetic-updates APT policy: (500, 'kinetic-updates'), (500, 'kinetic-security'), (500, 'kinetic'), (100, 'kinetic-backports') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 5.19.0-29-generic (SMP w/8 CPU threads; PREEMPT) Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled
diff -Nru django-rich-1.4.0/debian/rules django-rich-1.4.0/debian/rules --- django-rich-1.4.0/debian/rules 2023-01-15 08:19:23.000000000 +0100 +++ django-rich-1.4.0/debian/rules 2023-02-02 12:05:10.000000000 +0100 @@ -12,4 +12,4 @@ # Upstream uses a more agressive call, wont work here # as at least the package we build isn't installed so # using a modified pytest call. - dh_auto_test -- --system=custom --test-args="{interpreter} -m coverage run -m pytest tests" + TERM= dh_auto_test -- --system=custom --test-args="{interpreter} -m coverage run -m pytest tests"