jerry-git / jerry-git/pytest-split

Exception during test collection results in ZeroDivisionError

Open
#4 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
325
Forks
56
PR merge metrics
No merged PRs in 30d

Description

In short, this:
`pytest --splits 3 --group 1`

results in this
```
File "/home/user/.venv/lib/python3.8/site-packages/pytest_split/plugin.py", line 114, in _calculate_suite_start_and_end_idx
avg_duration_per_test = sum(stored_durations.values()) / len(stored_durations)
ZeroDivisionError: division by zero
```

if there's e.g. some `ImportError` during test collection.

The ZeroDivisionError hides the original exception.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with `pytest --splits 3 --group 1`, then inspect `pytest_split/plugin.py` at `_calculate_suite_start_and_end_idx`, especially line 114. Confirm that a collection-time `ImportError` is being replaced by `ZeroDivisionError`; done means the original collection exception remains visible instead.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.