Skip to content

test_scripts.py fails on master due to invalid JSON generation in get_results_file_path() #1239

@AdityaDagar000

Description

@AdityaDagar000

Summary

While working on issue #939, I noticed that all 5 tests in
tests/test_scripts.py fail on the current master branch
before any changes.

Root Cause

The get_results_file_path() function in tests/test_scripts.py
runs floss/main.py with --no static -j to generate a
results.json file. However the command fails and writes an
error message instead of valid JSON, causing all subsequent
script tests to fail with a pydantic ValidationError.

Steps to Reproduce

  1. Clone the repo
  2. Install dependencies with pip install -e ".[dev]"
  3. Run python -m pytest tests/test_scripts.py -v

Expected Result

All 5 tests pass

Actual Result

All 5 tests fail with:
Invalid JSON: expected value at line 1 column 1

Environment

  • OS: Windows 11
  • Python: 3.11.9
  • pytest: 8.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions