numirias / pytest-json-report

🗒️ A pytest plugin to report test results as JSON
MIT License
147 stars 39 forks source link

Report not getting saved when running the command using python #97

Open ManishAradwad opened 2 months ago

ManishAradwad commented 2 months ago

I'm calling pytest using python in my code as follows:

# Construct the command
command = f'cd /d "{file_dir}" && python -m pytest --json-report "{test_file_name}" -v --cov="{repo_path}" --cov-report term --cov-report html:"{repo_path}/htmlcov"'
# Run the command
process = subprocess.Popen(
    command,
    stdout=subprocess.PIPE,
    stderr=subprocess.STDOUT,
    universal_newlines=True,
    shell=True,
)

I'm getting this in the text report generated, but there is no .report.json file getting saved.

--------------------------------- JSON report ---------------------------------
report saved to: .report.json

Can someone help me with this plase?