{"library":"pytest-isort","title":"pytest-isort","description":"pytest-isort is a pytest plugin that integrates isort's import ordering and formatting checks directly into the pytest test suite. It ensures that all Python files discoverable by pytest adhere to isort's configured rules, failing the test run if any incorrectly sorted imports are found. The current version is 4.0.0, released in February 2024, with active maintenance and updates to support newer Python and pytest versions.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install pytest-isort"],"cli":null},"imports":[],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\n\n# test_imports.py\n\nimport os\nimport sys\nfrom collections import defaultdict\n\ndef test_correct_imports():\n    # This test will pass isort checks if imports are sorted correctly\n    assert True\n\ndef test_bad_imports():\n    # This test (or file content) will cause pytest-isort to fail\n    # if imports are not sorted.\n    x = 1 # Added to avoid 'Empty file' issue with isort check itself\n    assert True\n\n# To run this, save it as `test_imports.py` and run `pytest` in the same directory.\n# If the imports within the file are not sorted according to isort rules,\n# pytest-isort will report a failure.","lang":"python","description":"To quickly use `pytest-isort`, simply install it and run `pytest`. The plugin automatically discovers and checks Python files collected by pytest for correct import ordering based on your project's `isort` configuration. If any files have unsorted imports, `pytest` will report a failure.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}