Outils de développement
***********************

The modules described in this chapter help you write software.  For
example, the "pydoc" module takes a module and generates documentation
based on the module's contents.  The "doctest" and "unittest" modules
contains frameworks for writing unit tests that automatically exercise
code and verify that the expected output is produced.

La liste des modules documentés dans ce chapitre est :

* "typing" --- Support for type hints

  * Specification for the Python Type System

  * Alias de type

  * *NewType*

  * Annotating callable objects

  * Génériques

  * Annotating tuples

  * The type of class objects

  * Annotating generators and coroutines

  * Types génériques définis par l'utilisateur

  * Le type "Any"

  * Sous-typage nominal et sous-typage structurel

  * Classe de données

    * Special typing primitives

      * Special types

      * Special forms

      * Building generic types and type aliases

      * Other special directives

    * Protocoles

    * ABCs and Protocols for working with I/O

    * Functions and decorators

    * Utilitaires d'introspection

    * Constante

    * Deprecated aliases

      * Aliases to built-in types

      * Aliases to types in "collections"

      * Aliases to other concrete types

      * Aliases to container ABCs in "collections.abc"

      * Aliases to asynchronous ABCs in "collections.abc"

      * Aliases to other ABCs in "collections.abc"

      * Aliases to "contextlib" ABCs

  * Étapes d'Obsolescence des Fonctionnalités Majeures

* "pydoc" --- Documentation generator and online help system

* Python Development Mode

  * Effects of the Python Development Mode

  * ResourceWarning Example

  * Bad file descriptor error example

* "doctest" — Exemples de tests interactifs en Python

  * Utilisation simple : vérifier des exemples dans des *docstrings*

  * Utilisation simple : vérifier des exemples dans un fichier texte

  * Command-line Usage

  * Comment ça marche

    * Quelles *docstrings* sont considérées ?

    * Comment les exemples *docstring* sont-ils identifiés ?

    * Quel est le contexte d'exécution ?

    * Qu'en est-il des exceptions ?

    * Options de ligne de commande

    * Instructions

    * Avertissements

  * API de base

  * API de tests unitaires

  * API avancé

    * Objets *doctest*

    * Exemples d'objets

    * Objets *DocTestFinder*

    * Objets *DocTestParser*

    * Objets *TestResults*

    * Objets *DocTestRunner*

    * Objets *OutputChecker*

  * Débogage

  * Éditorial

* "unittest" --- Unit testing framework

  * Exemple basique

  * Interface en ligne de commande

    * Options de la ligne de commande

  * Découverte des tests

  * Organiser le code de test

  * Réutilisation d'ancien code de test

  * Ignorer des tests et des erreurs prévisibles

  * Distinguer les itérations de test à l'aide de sous-tests

  * Classes et fonctions

    * Scénarios de tests

    * Regroupement des tests

    * Chargement et exécution des tests

      * Protocole de chargement des tests (*load_tests Protocol*)

  * Classes et modules d'aménagements des tests

    * Classes de mise en place (*setUpClass*) et de démantèlement des
      tests (*tearDownClass*)

    * Module de mise en place (*setUpModule*) et de démantèlement des
      tests (*tearDownModule*)

  * Traitement des signaux

* "unittest.mock" --- mock object library

  * Guide rapide

  * La classe *Mock*

    * Calling

    * Deleting Attributes

    * Mock names and the name attribute

    * Attaching Mocks as Attributes

  * The patchers

    * patch

    * patch.object

    * patch.dict

    * patch.multiple

    * patch methods: start and stop

    * patch builtins

    * TEST_PREFIX

    * Nesting Patch Decorators

    * Where to patch

    * Patching Descriptors and Proxy Objects

  * MagicMock and magic method support

    * Mocking Magic Methods

    * Magic Mock

  * Helpers

    * sentinel

    * DEFAULT

    * appel

    * create_autospec

    * ANY

    * FILTER_DIR

    * mock_open

    * Autospeccing

    * Sealing mocks

  * Order of precedence of "side_effect", "return_value" and *wraps*

* "unittest.mock" --- getting started

  * Utilisation de Mock ou l'art de singer

    * Simulation des méthodes

    * S'assurer de la bonne utilisation d'un objet

    * Simulation des classes

    * Naming your mocks

    * Tracking all Calls

    * Setting Return Values and Attributes

    * Raising exceptions with mocks

    * Side effect functions and iterables

    * Mocking asynchronous iterators

    * Mocking asynchronous context manager

    * Creating a Mock from an Existing Object

    * Using side_effect to return per file content

  * Patch Decorators

  * Further Examples

    * Mocking chained calls

    * Partial mocking

    * Mocking a Generator Method

    * Applying the same patch to every test method

    * Mocking Unbound Methods

    * Checking multiple calls with mock

    * Coping with mutable arguments

    * Nesting Patches

    * Mocking a dictionary with MagicMock

    * Mock subclasses and their attributes

    * Mocking imports with patch.dict

    * Tracking order of calls and less verbose call assertions

    * More complex argument matching

* "test" --- Regression tests package for Python

  * Writing Unit Tests for the "test" package

  * Running tests using the command-line interface

* "test.support" --- Utilities for the Python test suite

* "test.support.socket_helper" --- Utilities for socket tests

* "test.support.script_helper" --- Utilities for the Python execution
  tests

* "test.support.bytecode_helper" --- Support tools for testing correct
  bytecode generation

* "test.support.threading_helper" --- Utilities for threading tests

* "test.support.os_helper" --- Utilities for os tests

* "test.support.import_helper" --- Utilities for import tests

* "test.support.warnings_helper" --- Utilities for warnings tests
