Use ternary operator to remove mypy error
Use ternary operator to remove mypy error

Otherwise we would get this error:

```
error: Function "Callable[[Any, bool, Optional[float]], None]" could always be true in boolean context  [truthy-function]
```

pytest-dev/pytest-xdist