{"id":28109,"library":"pytest-expect-test","title":"pytest-expect-test","description":"A lightweight pytest plugin providing an `expect` fixture for snapshot testing. Version 0.1.0 is the initial release, requiring Python >=3.5. Development appears low-frequency, with no recent updates.","status":"active","version":"0.1.0","language":"python","source_language":"en","source_url":"https://github.com/daninge98/pytest-expect-test","tags":["pytest","expect-test","snapshot-testing","testing"],"install":[{"cmd":"pip install pytest-expect-test","lang":"bash","label":"PyPI"}],"dependencies":[],"imports":[{"note":"Direct import of the module gives pytest plugin; the fixture needs explicit import.","wrong":"import pytest_expect_test","symbol":"expect","correct":"from pytest_expect_test import expect"}],"quickstart":{"code":"def test_example(expect):\n    expect(2 + 2) == 4\n    # The first run records the expectation, subsequent runs compare.","lang":"python","description":"Basic usage: use the `expect` fixture to assert equality. On first run, the expected value is recorded; later runs check against the recorded snapshot."},"warnings":[{"fix":"Review the recorded expectations (typically stored in test directory) and commit them to version control.","message":"On first test run, the test passes regardless of the actual value because the expectation is recorded. Subsequent runs will fail if the actual value differs from recorded.","severity":"gotcha","affected_versions":"0.1.0"},{"fix":"Define test with `def test_foo(expect):` to inject the fixture.","message":"The `expect` fixture must be used as a parameter in the test function; it is not a regular assertion. Do not call `expect()` as a function without the fixture injection.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Run `pip install pytest-expect-test` and use `from pytest_expect_test import expect`.","cause":"Attempting to import `expect` directly from `pytest` or without installing the plugin.","error":"ImportError: cannot import name 'expect'"},{"fix":"Use `expect` as a function parameter in the test method: `def test_example(self, expect): expect(...)`","cause":"Using `self.expect` inside a test method in a class while `expect` is passed as a parameter. Not supported as class attribute.","error":"AttributeError: 'Test' object has no attribute 'expect'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}