gTTS icon indicating copy to clipboard operation
gTTS copied to clipboard

test_cli test failures

Open PureTryOut opened this issue 4 years ago • 4 comments

I'm running the gTTS tests on Alpine Linux using Python 3.8 and the latest versions of all dependencies. Currently 2 tests in gtts/tests/test_cli.py are failing:

============================================================= FAILURES ==============================================================
__________________________________________________________ test_file_ascii __________________________________________________________

    def test_file_ascii():
        with LogCapture() as lc:
            result = runner_debug(['--file', textfile_ascii])
            log = logcapture_str(lc)
    
>       assert "text: %s" % text in log
E       assert ('text: %s' % "Can you make pink a little more pinkish can you make pink a little more pinkish, nor can you make the font bigger?\nHow much will it cost the website doesn't have the theme i was going for.") in 'No logging captured'

gtts/tests/test_cli.py:230: AssertionError
__________________________________________________________ test_file_utf8 ___________________________________________________________

    def test_file_utf8():
        with LogCapture() as lc:
            result = runner_debug(['--file', textfile_utf8])
            log = logcapture_str(lc)
    
>       assert "text: %s" % text_unicode in log
E       AssertionError: assert ('text: %s' % '这是一个三岁的小孩\n在讲述她从一系列照片里看到的东西。\n对这个世界, 她也许还有很多要学的东西,\n但在一个重要的任务上, 她已经是专家了:\n去理解她所看到的东西。') in 'No logging captured'

gtts/tests/test_cli.py:239: AssertionError

PureTryOut avatar May 07 '20 08:05 PureTryOut

Hi @PureTryOut! Thanks for that! So I tried to reproduce this but wasn't able to. The closest to an Alpine Linux w/ Python 3.8 latest I have handy is basically the python:3.8.2-alpine3.11 Docker image:

docker run --rm -it --volume ~/repos/gTTS:/gTTS --entrypoint sh python:3.8.2-alpine3.11

apk add build-base openssl-dev libffi-dev
# <installs>
cd gTTS
pip install -e .[tests]
# <installs>

And then:

pytest -v -s gtts/tests/test_cli.py::test_file_ascii
# <snip>
gtts/tests/test_cli.py::test_file_ascii PASSED

pytest -v -s gtts/tests/test_cli.py::test_file_utf8
# <snip>
gtts/tests/test_cli.py::test_file_utf8 PASSED

So I can't really say.

One thing however is that a lot of these tests are too finicky for my tastes and aren't as good as they could be b/c they had to also run on Py2.7 (for example here, unittest's assertLogs came in Python 3.4 so I had to use 'testfixtures'). Not that 2.7 is officially gone, I just need time to cleanse this project of any Python 2.7!

Of course won't doesn't necessarily fix the issue you found, though..

pndurette avatar May 08 '20 01:05 pndurette

Ah well if you have access to docker, it should be relatively easy to reproduce.

Get the alpine:edge image, install Python 3 and all deps you need for gTTS (apk add py3-twine py3-click py3-beautifulsoup4 py3-pytest py3-mock) and the remaining ones (those that are not in the repos yet) via pip, pip install gtts-token testfixtures.

Then you should get the same failures as I do.

PureTryOut avatar May 08 '20 06:05 PureTryOut

Sorry, why did you close this @pndurette?

PureTryOut avatar Nov 12 '20 08:11 PureTryOut

Sorry, why did you close this @pndurette?

My mistake, reopening. Was doing a bit of a cleanup. New updates will come and should help with this—such as stripping all the Py7 stuff—will will also include a lot of test simplification and cleanup.

pndurette avatar Nov 12 '20 15:11 pndurette

I tried the tests again with 2.2.4 and these seem to pass now! :tada:

PureTryOut avatar Sep 15 '22 06:09 PureTryOut