kiwicom / pytest-recording

A pytest plugin that allows recording network interactions via VCR.py
MIT License
445 stars 35 forks source link

[BUG] having this plugin enabled breaks Intellij Idea failed test reports #83

Open CarloDePieri opened 2 years ago

CarloDePieri commented 2 years ago

Ok, so this was a weird one to debug...

Simply having the pytest-recording plugin enabled breaks Intellij Idea pytest failed test reports in some specific test cases (here is an example):

Instead of reporting the correct stack trace and main error, Idea reports there has been a failed string comparison involving url paths.

My guess is that pytest-recording breaks something Idea's test runner relies on to generate errors messages, because:

How to reproduce the issue

Checkout the minimal test repo with git clone https://github.com/CarloDePieri/pytest-recording-idea-issue.

Create a virtualenv and install all dependencies there:

cd pytest-recording-idea-issue
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

IMPORTANT:

Then:

Under the hood

Idea uses this test runner to launch pytest tests and generate the report message. Launching the script directly in the terminal shows indeed the wrong error message when pytest-recording is installed.

Installed software versions

python: 3.10.4
pytest: 7.1.2
pytest-recording: 0.12.0
vcrpy: 4.1.1
requests: 2.27.1
Idea Ultimate: Build #IU-221.5591.52, built on May 10, 2022
os: arch linux