or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

blueprints.mdcli.mdconfiguration.mdcontext-globals.mdcore-application.mdhelpers.mdindex.mdjson-support.mdrequest-response.mdrouting.mdsessions.mdsignals.mdtemplates.mdtesting.md

testing.mddocs/

0

# Testing Support

1

2

Flask provides comprehensive testing utilities including test clients for making requests and CLI runners for testing command-line interfaces.

3

4

## Capabilities

5

6

### Test Client

7

8

```python { .api }

9

class FlaskClient:

10

def get(self, *args, **kwargs) -> TestResponse: ...

11

def post(self, *args, **kwargs) -> TestResponse: ...

12

def put(self, *args, **kwargs) -> TestResponse: ...

13

def delete(self, *args, **kwargs) -> TestResponse: ...

14

def patch(self, *args, **kwargs) -> TestResponse: ...

15

def head(self, *args, **kwargs) -> TestResponse: ...

16

def options(self, *args, **kwargs) -> TestResponse: ...

17

```

18

19

### CLI Test Runner

20

21

```python { .api }

22

class FlaskCliRunner:

23

def invoke(self, cli, args=None, input=None, env=None, **extra): ...

24

```

25

26

## Usage Examples

27

28

### Basic Testing

29

30

```python

31

import pytest

32

from flask import Flask

33

34

@pytest.fixture

35

def app():

36

app = Flask(__name__)

37

app.config['TESTING'] = True

38

return app

39

40

@pytest.fixture

41

def client(app):

42

return app.test_client()

43

44

def test_home(client):

45

response = client.get('/')

46

assert response.status_code == 200

47

```