From 1ba236d06c12bc84e1373b0d4eb965589056a4c6 Mon Sep 17 00:00:00 2001 From: Benjamin Gleitzman Date: Sat, 19 Feb 2022 13:05:37 -0800 Subject: [PATCH] Enable colorization using the `script` command. More info at https://github.com/actions/runner/issues/241#issuecomment-577360161 --- .github/workflows/python-non-master.yml | 5 +++-- .github/workflows/python.yml | 5 +++-- test_howdoi.py | 7 ++----- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/python-non-master.yml b/.github/workflows/python-non-master.yml index 40663bdb4..4e5db3514 100644 --- a/.github/workflows/python-non-master.yml +++ b/.github/workflows/python-non-master.yml @@ -35,5 +35,6 @@ jobs: run: | pylint howdoi *.py --rcfile=.pylintrc - name: Test with nose - run: | - nose2 + if: runner.os == 'Linux' + shell: 'script -q -e -c "bash {0}"' + run: script -e -c nose2 diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 984b64ad9..d4793be48 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -31,5 +31,6 @@ jobs: run: | pylint howdoi *.py --rcfile=.pylintrc - name: Test with nose - run: | - nose2 + if: runner.os == 'Linux' + shell: 'script -q -e -c "bash {0}"' + run: script -e -c nose2 diff --git a/test_howdoi.py b/test_howdoi.py index 35aac5254..4524a994a 100644 --- a/test_howdoi.py +++ b/test_howdoi.py @@ -196,11 +196,8 @@ def test_colorize(self): normal = howdoi.howdoi(query) colorized = howdoi.howdoi('-c ' + query) - # There is currently an issue with Github actions and colorization - # so do not run checks if we are running in Github - if "GITHUB_ACTION" not in os.environ: - self.assertTrue(normal.find('[38;') == -1) - self.assertTrue(colorized.find('[38;') != -1) + self.assertTrue(normal.find('[38;') == -1) + self.assertTrue(colorized.find('[38;') != -1) # pylint: disable=line-too-long def test_get_text_without_links(self):