pndurette / gTTS

Python library and CLI tool to interface with Google Translate's text-to-speech API
http://gtts.readthedocs.org/
MIT License
2.26k stars 361 forks source link

test fails: test_file_ascii and test_file_utf8: AssertionError #393

Closed nunotexbsd closed 1 year ago

nunotexbsd commented 1 year ago

Prerequisites

Current Behaviour (steps to reproduce)

gtts/tests/test_cli.py::test_file_ascii FAILED                           [ 15%]
gtts/tests/test_cli.py::test_file_utf8 FAILED                            [ 16%]
(...)
=================================== FAILURES ===================================
_______________________________ test_file_ascii ________________________________

    @pytest.mark.net
    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:233: AssertionError
________________________________ test_file_utf8 ________________________________

    @pytest.mark.net
    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:243: AssertionError
======================== 2 failed, 95 passed in 33.54s =========================

Environment

platform freebsd13 -- Python 3.9.16, pytest-7.2.0, pluggy-1.0.0 -- /usr/local/bin/python3.9 cachedir: .pytest_cache rootdir: /wrkdirs/usr/ports/audio/py-gtts/work-py39/gTTS-2.3.0, configfile: pyproject.toml plugins: cov-2.9.0

Any clues?

pndurette commented 1 year ago

Hi @nunotexbsd!

Are you running the tests from the installed version of gTTS by any chance? It looks like the input files used for these 2 tests aren't packaged (because they're .txt and not picked up by default)

I was actually wanting to remove the tests altogether from the package itself. Is there a reason why you want to run the tests from there?

nunotexbsd commented 1 year ago

I'm doing tests from source gTTS-2.3.0.tar.gz tarball from pypi.org.

pndurette commented 1 year ago

Ah the source should indeed contain all tests and their required files. I'll include them in.