apache / apache/arrow

Using pytest to debug a flight.FlightServerBase subclass

Open
#36,844 4 comments 0 reactions 0 assignees View on GitHub
Component: Python Type: usage
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the usage question you have. Please include as many useful details as possible.

I'd like to be able to set breakpoints in my `flight.FlightServerBase` subclass to be able to debug my code, using `VSCode`. Currently, I instantiate a local server and a client in pytest like this:

```python
@pytest.fixture(scope="session")
def test_client():
with InferenceFlightServer(address) as _, FlightClient(address) as client:
yield client
```

and using the client to call a `do_exchange` function within a test like this:

```python
writer, reader = test_client.do_exchange(descriptor)
```

However, I cannot make my debugger stop in any of the breakpoints within the subclass. What I'm looking for is something similar to how flask `test_client` [works](https://flask.palletsprojects.com/en/2.2.x/testing/), that makes it possible to debug the service endpoints.

Here's my `launch.json` config:

```json
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": false
}
]
}
```

Currently using `pyarrow==12.0.1` under a macOS M1 processor.

Similar issue I found with no solution can be found [here](https://youtrack.jetbrains.com/issue/PY-55955).

### Component(s)

Python

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.