{"id":24702,"library":"texttest","title":"TextTest","description":"TextTest is a tool for text-based Approval Testing, enabling developers to capture and compare output of command-line applications. Current version is 4.4.6, with a stable release cadence.","status":"active","version":"4.4.6","language":"python","source_language":"en","source_url":"https://github.com/texttest/texttest","tags":["testing","approval testing","text-based"],"install":[{"cmd":"pip install texttest","lang":"bash","label":"PyPI"}],"dependencies":[],"imports":[{"note":"Direct import of TextTest class is the correct pattern; importing the module and using texttest.TextTest still works but is less common.","wrong":"import texttest","symbol":"TextTest","correct":"from texttest import TextTest"},{"note":"","wrong":"","symbol":"texttest_diff","correct":"from texttest import texttest_diff"}],"quickstart":{"code":"from texttest import TextTest\nimport os\n\ntest = TextTest(\n    command='echo \"Hello, World!\"',\n    name='hello_world',\n    directory='/tmp/texttest_example',\n    # For authentication or environment: use os.environ.get('KEY', '')\n)\ntest.run()\nassert test.passed\nprint('Test passed!')","lang":"python","description":"Basic approval test that captures stdout and compares to previously approved output."},"warnings":[{"fix":"Update Python to 3.9 or higher.","message":"TextTest 4.x dropped support for Python < 3.9. If upgrading from older versions, ensure your environment uses Python 3.9+.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Always provide an absolute path (e.g., use `os.path.abspath`) for the `directory` argument.","message":"The `directory` parameter must be an absolute path. Relative paths can cause unexpected behavior or test failures.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace `config_file='path'` with `config={'key': 'value'}` in the TextTest constructor.","message":"The `config_file` argument is deprecated in favor of passing configuration via the `config` dict parameter.","severity":"deprecated","affected_versions":">=4.3.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `pip install texttest` in the correct environment.","cause":"The library is not installed or installed in a different Python environment.","error":"ModuleNotFoundError: No module named 'texttest'"},{"fix":"Replace `texttest_root` with `directory` in the TextTest constructor.","cause":"The parameter `texttest_root` was renamed to `directory` in version 4.0.","error":"TypeError: __init__() got an unexpected keyword argument 'texttest_root'"},{"fix":"If this is the first run, approve the current output by running with `--approve` flag or using the `approve()` method. If output changed intentionally, update the approved file.","cause":"The actual output does not match the previously approved output, or no approved file exists yet.","error":"AssertionError: Test failed: output differs from approved"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}