tldr-pages / tldr-python-client

Python command-line client for tldr pages
https://pypi.org/project/tldr/
MIT License
592 stars 92 forks source link

test_whole_page failures #209

Closed ainola closed 4 months ago

ainola commented 1 year ago

Looks like the content being served has changed:

tests/test_tldr.py FF..........................                          [100%]

=================================== FAILURES ===================================
_____________________________ test_whole_page[gem] _____________________________

page_name = 'gem'

    @pytest.mark.parametrize("page_name", page_names)
    def test_whole_page(page_name):
        with open(f"tests/data/{page_name}.md", "rb") as f_original:
            with open(f"tests/data/{page_name}_rendered", "rb") as f_rendered:
                old_stdout = sys.stdout
                sys.stdout = io.StringIO()
                sys.stdout.buffer = types.SimpleNamespace()
                sys.stdout.buffer.write = lambda x: sys.stdout.write(x.decode("utf-8"))
                tldr.output(f_original)

                sys.stdout.seek(0)
                tldr_output = sys.stdout.read().encode("utf-8")
                sys.stdout = old_stdout

                correct_output = f_rendered.read()
>               assert tldr_output == correct_output
E               AssertionError: assert b'\n  gem\n\n...l gemname\n\n' == b'\n  \x1b[1m...1m\x1b[0m\n\n'
E                 At index 3 diff: b'g' != b'\x1b'
E                 Use -v to get more diff

tests/test_tldr.py:29: AssertionError
_____________________________ test_whole_page[jq] ______________________________

page_name = 'jq'

    @pytest.mark.parametrize("page_name", page_names)
    def test_whole_page(page_name):
        with open(f"tests/data/{page_name}.md", "rb") as f_original:
            with open(f"tests/data/{page_name}_rendered", "rb") as f_rendered:
                old_stdout = sys.stdout
                sys.stdout = io.StringIO()
                sys.stdout.buffer = types.SimpleNamespace()
                sys.stdout.buffer.write = lambda x: sys.stdout.write(x.decode("utf-8"))
                tldr.output(f_original)

                sys.stdout.seek(0)
                tldr_output = sys.stdout.read().encode("utf-8")
                sys.stdout = old_stdout

                correct_output = f_rendered.read()
>               assert tldr_output == correct_output
E               assert b'\n  jq\n\n ..._name)"\'\n\n' == b'\n  \x1b[1m...\'\x1b[0m\n\n'
E                 At index 3 diff: b'j' != b'\x1b'
E                 Use -v to get more diff
MasterOdin commented 1 year ago

What version of termcolor and colorama do you have? It may be that the program has broken on an older or newer version of those programs than what we test against.

ainola commented 1 year ago

Termcolor 2.2.0-1 and 0.4.6-1 from Arch Linux

ainola commented 4 months ago

Hello again! It's been a while.

I just ran tests to see if they're still broken but it looks like they're functional again. Closing.