> **Источник:** https://python-all.ru/2.7/library/development.html
>
> «Документация Python на русском» – неофициальный перевод официальной документации Python: версии от 2.6 до 3.16, полнотекстовый поиск, английский оригинал рядом с переводом. Эта Markdown-версия страницы предназначена для работы с LLM: вставьте её в ChatGPT, Claude или Cursor.

---

# 25. Средства разработки

Модули, описанные в этой главе, помогают писать программное обеспечение. Например, модуль [`pydoc`](https://python-all.ru/2.7/library/pydoc.html#module-pydoc) принимает модуль и генерирует документацию на основе его содержимого. Модули [`doctest`](https://python-all.ru/2.7/library/doctest.html#module-doctest) и [`unittest`](https://python-all.ru/2.7/library/unittest.html#module-unittest) содержат фреймворки для написания модульных тестов, которые автоматически выполняют код и проверяют, что вывод соответствует ожидаемому. **2to3** может переводить исходный код Python 2.x в корректный код Python 3.x.

Список модулей, описанных в этой главе:

- [25.1. `pydoc` – генератор документации и справочная система](https://python-all.ru/2.7/library/pydoc.html)
- [25.2. `doctest` – тестирование интерактивных примеров Python](https://python-all.ru/2.7/library/doctest.html)

  - [25.2.1. Простое использование: проверка примеров в docstrings](https://python-all.ru/2.7/library/doctest.html#simple-usage-checking-examples-in-docstrings)
  - [25.2.2. Простое использование: проверка примеров в текстовом файле](https://python-all.ru/2.7/library/doctest.html#simple-usage-checking-examples-in-a-text-file)
  - [25.2.3. Как это работает](https://python-all.ru/2.7/library/doctest.html#how-it-works)

    - [25.2.3.1. Какие docstrings проверяются?](https://python-all.ru/2.7/library/doctest.html#which-docstrings-are-examined)
    - [25.2.3.2. Как распознаются примеры в строках документации?](https://python-all.ru/2.7/library/doctest.html#how-are-docstring-examples-recognized)
    - [25.2.3.3. Каков контекст выполнения?](https://python-all.ru/2.7/library/doctest.html#what-s-the-execution-context)
    - [25.2.3.4. А что насчёт исключений?](https://python-all.ru/2.7/library/doctest.html#what-about-exceptions)
    - [25.2.3.5. Флаги параметров](https://python-all.ru/2.7/library/doctest.html#option-flags)
    - [25.2.3.6. Директивы](https://python-all.ru/2.7/library/doctest.html#directives)
    - [25.2.3.7. Предупреждения](https://python-all.ru/2.7/library/doctest.html#warnings)
  - [25.2.4. Базовый API](https://python-all.ru/2.7/library/doctest.html#basic-api)
  - [25.2.5. API модуля unittest](https://python-all.ru/2.7/library/doctest.html#unittest-api)
  - [25.2.6. Продвинутый API](https://python-all.ru/2.7/library/doctest.html#advanced-api)

    - [25.2.6.1. Объекты DocTest](https://python-all.ru/2.7/library/doctest.html#doctest-objects)
    - [25.2.6.2. Объекты Example](https://python-all.ru/2.7/library/doctest.html#example-objects)
    - [25.2.6.3. Объекты DocTestFinder](https://python-all.ru/2.7/library/doctest.html#doctestfinder-objects)
    - [25.2.6.4. Объекты DocTestParser](https://python-all.ru/2.7/library/doctest.html#doctestparser-objects)
    - [25.2.6.5. Объекты DocTestRunner](https://python-all.ru/2.7/library/doctest.html#doctestrunner-objects)
    - [25.2.6.6. Объекты OutputChecker](https://python-all.ru/2.7/library/doctest.html#outputchecker-objects)
  - [25.2.7. Отладка](https://python-all.ru/2.7/library/doctest.html#debugging)
  - [25.2.8. Разное](https://python-all.ru/2.7/library/doctest.html#soapbox)
- [25.3. `unittest` – фреймворк для модульного тестирования](https://python-all.ru/2.7/library/unittest.html)

  - [25.3.1. Простой пример](https://python-all.ru/2.7/library/unittest.html#basic-example)
  - [25.3.2. Интерфейс командной строки](https://python-all.ru/2.7/library/unittest.html#command-line-interface)

    - [25.3.2.1. Параметры командной строки](https://python-all.ru/2.7/library/unittest.html#command-line-options)
  - [25.3.3. Обнаружение тестов](https://python-all.ru/2.7/library/unittest.html#test-discovery)
  - [25.3.4. Организация тестового кода](https://python-all.ru/2.7/library/unittest.html#organizing-test-code)
  - [25.3.5. Повторное использование старого тестового кода](https://python-all.ru/2.7/library/unittest.html#re-using-old-test-code)
  - [25.3.6. Пропуск тестов и ожидаемые сбои](https://python-all.ru/2.7/library/unittest.html#skipping-tests-and-expected-failures)
  - [25.3.7. Классы и функции](https://python-all.ru/2.7/library/unittest.html#classes-and-functions)

    - [25.3.7.1. Тестовые примеры](https://python-all.ru/2.7/library/unittest.html#test-cases)

      - [25.3.7.1.1. Устаревшие псевдонимы](https://python-all.ru/2.7/library/unittest.html#deprecated-aliases)
    - [25.3.7.2. Группировка тестов](https://python-all.ru/2.7/library/unittest.html#grouping-tests)
    - [25.3.7.3. Загрузка и запуск тестов](https://python-all.ru/2.7/library/unittest.html#loading-and-running-tests)

      - [25.3.7.3.1. Протокол load\_tests](https://python-all.ru/2.7/library/unittest.html#load-tests-protocol)
  - [25.3.8. Фикстуры классов и модулей](https://python-all.ru/2.7/library/unittest.html#class-and-module-fixtures)

    - [25.3.8.1. setUpClass и tearDownClass](https://python-all.ru/2.7/library/unittest.html#setupclass-and-teardownclass)
    - [25.3.8.2. setUpModule и tearDownModule](https://python-all.ru/2.7/library/unittest.html#setupmodule-and-teardownmodule)
  - [25.3.9. Обработка сигналов](https://python-all.ru/2.7/library/unittest.html#signal-handling)
- [25.4. 2to3 – автоматическое преобразование кода Python 2 в 3](https://python-all.ru/2.7/library/2to3.html)

  - [25.4.1. Использование 2to3](https://python-all.ru/2.7/library/2to3.html#using-2to3)
  - [25.4.2. Исправители](https://python-all.ru/2.7/library/2to3.html#fixers)
  - [25.4.3. `lib2to3` - библиотека 2to3](https://python-all.ru/2.7/library/2to3.html#module-lib2to3)
- [25.5. `test` – пакет регрессионных тестов для Python](https://python-all.ru/2.7/library/test.html)

  - [25.5.1. Написание модульных тестов для пакета `test`](https://python-all.ru/2.7/library/test.html#writing-unit-tests-for-the-test-package)
  - [25.5.2. Запуск тестов с помощью интерфейса командной строки](https://python-all.ru/2.7/library/test.html#running-tests-using-the-command-line-interface)
- [25.6. `test.support` – вспомогательные функции для тестов](https://python-all.ru/2.7/library/test.html#module-test.support)
